Skip to content

Commit b61d65f

Browse files
authored
Cython now defaults to language_version=3, and long is not available anymore (was available only in Py2) (#126)
1 parent 65f53bd commit b61d65f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pyobjus/pyobjus_conversions.pxi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,6 @@ cpdef object convert_py_to_nsobject(arg):
430430
return autoclass('NSNumber').alloc().initWithBool_(int(arg))
431431
elif isinstance(arg, (str, unicode)):
432432
return autoclass('NSString').alloc().initWithUTF8String_(arg)
433-
elif isinstance(arg, long):
434-
return autoclass('NSNumber').alloc().initWithInt_(arg)
435433
elif isinstance(arg, int):
436434
return autoclass('NSNumber').alloc().initWithLong_(arg)
437435
elif isinstance(arg, float):
@@ -525,10 +523,10 @@ cdef void* convert_py_arg_to_cy(arg, sig, by_value, size_t size) except *:
525523
# method is accepting long
526524
elif sig == b'l':
527525
if by_value:
528-
(<long*>val_ptr)[0] = <long>long(arg)
526+
(<long*>val_ptr)[0] = <long>int(arg)
529527
else:
530528
if not objc_ref:
531-
(<long*>arg_val_ptr)[0] = <long>long(arg)
529+
(<long*>arg_val_ptr)[0] = <long>int(arg)
532530
(<long**>val_ptr)[0] = <long*>arg_val_ptr
533531
# method is accepting long long
534532
elif sig == b'q':
@@ -692,7 +690,7 @@ cdef void* convert_py_arg_to_cy(arg, sig, by_value, size_t size) except *:
692690
# ARRAY, ETC.
693691
else:
694692
# TODO: Add better conversion between primitive types!
695-
if type(arg) is long:
693+
if type(arg) is int:
696694
(<void**>val_ptr)[0] = <void*><unsigned long long>arg
697695
elif type(arg) is str:
698696
# passing bytes as void* is the same as for char*

0 commit comments

Comments
 (0)