python: change to py-initialize in startup-hook and py-finalize in shutdown hook.
							parent
							
								
									6244b925c7
								
							
						
					
					
						commit
						ccfd9101f0
					
				| 
						 | 
					@ -13,7 +13,7 @@ HELP: >py
 | 
				
			||||||
{ $examples
 | 
					{ $examples
 | 
				
			||||||
  { $example
 | 
					  { $example
 | 
				
			||||||
    "USING: arrays prettyprint python sequences ;"
 | 
					    "USING: arrays prettyprint python sequences ;"
 | 
				
			||||||
    "py-initialize 10 iota >array >py py> ."
 | 
					    "10 iota >array >py py> ."
 | 
				
			||||||
    "{ 0 1 2 3 4 5 6 7 8 9 }"
 | 
					    "{ 0 1 2 3 4 5 6 7 8 9 }"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,6 @@ USING: accessors arrays assocs calendar continuations destructors fry kernel
 | 
				
			||||||
math namespaces python python.ffi python.objects sequences strings tools.test ;
 | 
					math namespaces python python.ffi python.objects sequences strings tools.test ;
 | 
				
			||||||
IN: python
 | 
					IN: python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
py-initialize
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: py-test ( result quot -- )
 | 
					: py-test ( result quot -- )
 | 
				
			||||||
    '[ _ with-destructors ] unit-test ; inline
 | 
					    '[ _ with-destructors ] unit-test ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
USING: accessors alien alien.c-types alien.data alien.strings arrays assocs
 | 
					USING: alien.c-types alien.data arrays assocs command-line fry
 | 
				
			||||||
command-line fry hashtables io.encodings.utf8 kernel namespaces python.errors
 | 
					hashtables init io.encodings.utf8 kernel namespaces
 | 
				
			||||||
python.ffi python.objects sequences specialized-arrays strings vectors ;
 | 
					python.errors python.ffi python.objects sequences
 | 
				
			||||||
 | 
					specialized-arrays strings vectors ;
 | 
				
			||||||
IN: python
 | 
					IN: python
 | 
				
			||||||
QUALIFIED: math
 | 
					QUALIFIED: math
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,3 +97,6 @@ ERROR: missing-type type ;
 | 
				
			||||||
: py> ( py-obj -- obj )
 | 
					: py> ( py-obj -- obj )
 | 
				
			||||||
    dup "__class__" getattr "__name__" getattr PyString_AsString
 | 
					    dup "__class__" getattr "__name__" getattr PyString_AsString
 | 
				
			||||||
    py-type-dispatch get ?at [ call( x -- x ) ] [ missing-type ] if ;
 | 
					    py-type-dispatch get ?at [ call( x -- x ) ] [ missing-type ] if ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[ py-initialize ] "py-initialize" add-startup-hook
 | 
				
			||||||
 | 
					[ py-finalize ] "py-finalize" add-shutdown-hook
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue