[issue43509] CFunctionType object should be hashable in Python

2021-03-22 Thread Xinmeng Xia


Change by Xinmeng Xia :


--
type: compile error -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43509] CFunctionType object should be hashable in Python

2021-03-15 Thread Xinmeng Xia

New submission from Xinmeng Xia :

See the following examples, ctypes.resize is a built-in function and it's 
hashable.   ctypes.memset is a C function (CFunctionType object) and it's 
“unhashable”.  However,  ctypes.resize and  ctypes.memset are both immutable. 
They should act the same in Python. It should not report unhashable type error 
when ctypes.memset  calls  __hash__(). 

---
>>> import ctypes
>>> ctypes.resize

>>> ctypes.resize.__hash__()
146309

>>> ctypes.memset

>>> ctypes.memset.__hash__()
Traceback (most recent call last):
File "", line 1, in 
TypeError: unhashable type
---

Python version: 3.9.2
system: Ubuntu
Expected output: 
ctypes.memset is hashable.

--
components: Interpreter Core
messages: 388804
nosy: xxm
priority: normal
severity: normal
status: open
title: CFunctionType object should be hashable in Python
type: compile error
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com