Skip to content

Commit 1322e60

Browse files
committed
Fix for PyNone_Type
1 parent 2830ead commit 1322e60

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/pycall/libpython.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,12 @@ def self.Py_None
174174
end
175175

176176
attach_variable :PyType_Type, PyTypeObjectStruct
177-
attach_variable :_PyNone_Type, PyTypeObjectStruct
177+
178+
if libpython.find_variable('_PyNone_Type')
179+
attach_variable :PyNone_Type, :_PyNone_Type, PyTypeObjectStruct
180+
else
181+
attach_variable :PyNone_Type, PyTypeObjectStruct
182+
end
178183

179184
if libpython.find_variable('PyInt_Type')
180185
has_PyInt_Type = true

spec/pycall/pyptr_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module PyCall
5959
end
6060

6161
it 'works for Python type objects' do
62-
pynone_type = PyPtr.incref(PyPtr.new(LibPython._PyNone_Type.to_ptr.address))
62+
pynone_type = PyPtr.incref(PyPtr.new(LibPython.PyNone_Type.to_ptr.address))
6363
pylong_type = PyPtr.incref(PyPtr.new(LibPython.PyLong_Type.to_ptr.address))
6464

6565
expect(PyPtr::None.kind_of?(pynone_type)).to eq(true)

0 commit comments

Comments
 (0)