Skip to content

Commit 8d6cc2f

Browse files
committed
Stop using PyNone_Type for Python 2.7
1 parent 1322e60 commit 8d6cc2f

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/pycall/libpython.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,6 @@ def self.Py_None
175175

176176
attach_variable :PyType_Type, PyTypeObjectStruct
177177

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
183-
184178
if libpython.find_variable('PyInt_Type')
185179
has_PyInt_Type = true
186180
attach_variable :PyInt_Type, PyTypeObjectStruct

spec/pycall/pyptr_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ 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+
pytype_type = PyPtr.incref(PyPtr.new(LibPython.PyType_Type.to_ptr.address))
6363
pylong_type = PyPtr.incref(PyPtr.new(LibPython.PyLong_Type.to_ptr.address))
6464

65-
expect(PyPtr::None.kind_of?(pynone_type)).to eq(true)
66-
expect(PyPtr::None.kind_of?(pylong_type)).to eq(false)
65+
expect(pylong_type.kind_of?(pytype_type)).to eq(true)
66+
expect(pylong_type.kind_of?(pylong_type)).to eq(false)
6767

6868
expect { PyPtr::None.kind_of?(PyPtr::None) }.to raise_error(TypeError)
6969
end

0 commit comments

Comments
 (0)