This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年03月05日 14:23 by erijo, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue14201.patch | erijo, 2012年07月16日 19:13 | Patch to documentation | review | |
| issue14201-v2.patch | meador.inge, 2012年07月20日 03:42 | |||
| Messages (12) | |||
|---|---|---|---|
| msg154949 - (view) | Author: Erik Johansson (erijo) | Date: 2012年03月05日 14:23 | |
I would expect that the following code would give True as result:
>>> from ctypes import *
>>> libc = CDLL("libc.so.6")
>>> libc.time == libc['time']
False
Is it by design that libc['time'] always returns a different _FuncPtr object? It is a bit confusing when doing things like:
libc['time'].restype = ...
libc['time'].argtypes = [...]
# python --version
Python 2.7.2+
Ubunutu version 2.7.2-5ubuntu1.
|
|||
| msg154957 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2012年03月05日 16:13 | |
This is intentional; the caching was removed in 214b28d7a999. Thomas, can you remember the rationale for this change? |
|||
| msg155089 - (view) | Author: Thomas Heller (theller) * (Python committer) | Date: 2012年03月07日 14:02 | |
The rationale was to allow different packages (for example) in the same process to have their own private instance of a foreign function, with possibly different definitions of restype, argtypes and/or errcheck. |
|||
| msg155091 - (view) | Author: Erik Johansson (erijo) | Date: 2012年03月07日 14:56 | |
Perhaps this behaviour should be documented somewhere (unless it already is)? |
|||
| msg155092 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年03月07日 15:08 | |
Item access is documented in this section: http://docs.python.org/library/ctypes#loading-shared-libraries (scroll a bit down looking for __getitem__); the wording about caching is ambiguous with respect to the current behavior. |
|||
| msg155094 - (view) | Author: Erik Johansson (erijo) | Date: 2012年03月07日 15:34 | |
Ah, I see. I modified the title to reflect this. Perhaps adding this simple example as well can help people (e.g. me) see it? >>> libc.time == libc.time True >>> libc['time'] == libc['time'] False |
|||
| msg165646 - (view) | Author: Erik Johansson (erijo) | Date: 2012年07月16日 19:13 | |
Document the difference between __getattr__ and __getitem__. |
|||
| msg165898 - (view) | Author: Meador Inge (meador.inge) * (Python committer) | Date: 2012年07月20日 03:42 | |
The general wording and example look good; thanks. I reworded things a little. Updated patch attached. |
|||
| msg166455 - (view) | Author: Meador Inge (meador.inge) * (Python committer) | Date: 2012年07月26日 04:02 | |
Any comments on this one? I plan on committing the changes tomorrow unless I hear something otherwise. |
|||
| msg171302 - (view) | Author: Erik Johansson (erijo) | Date: 2012年09月25日 18:03 | |
The issue14201-v2.patch patch looks good to me at least. |
|||
| msg228505 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年10月04日 22:26 | |
New changeset ae64614b66b7 by R David Murray in branch '2.7': #14201: Update ctypes docs to match behavior changed from 214b28d7a999. https://hg.python.org/cpython/rev/ae64614b66b7 New changeset 5518aa0fbc06 by R David Murray in branch '3.4': #14201: Update ctypes docs to match behavior changed from 214b28d7a999. https://hg.python.org/cpython/rev/5518aa0fbc06 New changeset dfdcc3fad3aa by R David Murray in branch 'default': Merge: #14201: Update ctypes docs to match behavior changed from 214b28d7a999. https://hg.python.org/cpython/rev/dfdcc3fad3aa |
|||
| msg228507 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2014年10月04日 22:27 | |
Committed. See also issue 22552. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58409 |
| 2014年10月04日 22:27:59 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg228507 resolution: fixed stage: commit review -> resolved |
| 2014年10月04日 22:26:51 | python-dev | set | nosy:
+ python-dev messages: + msg228505 |
| 2012年09月25日 18:03:15 | erijo | set | messages: + msg171302 |
| 2012年07月26日 04:02:02 | meador.inge | set | messages: + msg166455 |
| 2012年07月20日 03:42:11 | meador.inge | set | files:
+ issue14201-v2.patch messages: + msg165898 stage: needs patch -> commit review |
| 2012年07月16日 19:13:33 | erijo | set | files:
+ issue14201.patch keywords: + patch messages: + msg165646 |
| 2012年03月07日 15:34:01 | erijo | set | messages:
+ msg155094 title: libc.time != libc['time'] -> Documented caching for shared library's __getattr__ and __getitem__ is incorrect |
| 2012年03月07日 15:08:30 | eric.araujo | set | assignee: docs@python components: + Documentation keywords: + easy nosy: + docs@python, eric.araujo messages: + msg155092 stage: needs patch |
| 2012年03月07日 14:56:40 | erijo | set | messages: + msg155091 |
| 2012年03月07日 14:02:17 | theller | set | messages: + msg155089 |
| 2012年03月05日 16:13:24 | loewis | set | nosy:
+ theller, loewis messages: + msg154957 |
| 2012年03月05日 15:11:49 | pitrou | set | nosy:
+ amaury.forgeotdarc, belopolsky, meador.inge versions: + Python 3.2, Python 3.3 |
| 2012年03月05日 14:23:40 | erijo | create | |