File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -772,11 +772,18 @@ export class PyObject {
772772 * a proxy to Python object.
773773 */
774774 valueOf ( ) : any {
775+ if (
776+ Deno . UnsafePointer . equals (
777+ this . handle ,
778+ python . None [ ProxiedPyObject ] . handle ,
779+ )
780+ ) {
781+ return null ;
782+ }
783+
775784 const type = py . PyObject_Type ( this . handle ) ;
776785
777- if ( Deno . UnsafePointer . equals ( type , python . None [ ProxiedPyObject ] . handle ) ) {
778- return null ;
779- } else if (
786+ if (
780787 Deno . UnsafePointer . equals ( type , python . bool [ ProxiedPyObject ] . handle )
781788 ) {
782789 return this . asBoolean ( ) ;
Original file line number Diff line number Diff line change @@ -384,3 +384,7 @@ def call_the_callback(cb):
384384 pyCallback . destroy ( ) ;
385385 }
386386} ) ;
387+
388+ Deno . test ( "None valueOf is null" , ( ) => {
389+ assertEquals ( python . None . valueOf ( ) , null ) ;
390+ } ) ;
You can’t perform that action at this time.
0 commit comments