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.

Title: little inaccuracy in Py_ssize_t explanation
Type: Stage:
Components: Documentation Versions: Python 3.0, Python 3.1
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: exe, georg.brandl, loewis
Priority: normal Keywords:

Created on 2009-01-01 10:32 by exe, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg78695 - (view) Author: Kandalintsev Alexandre (exe) Date: 2009-01-01 10:32
Documentation says that

There’s no chance that the reference count can overflow; at least as many bits 
are used to hold the reference count as there are distinct memory locations in 
virtual memory (assuming sizeof(Py_ssize_t) >= sizeof(void*)). Thus, the 
reference count increment is a simple operation.

But Py_ssize_t is a signed type so in case of sizeof(Py_ssize_t) == sizeof
(void*)) it can only reference a half of memmory :). But because any python 
object consumes much more than 2bytes this is not a problem.
msg78835 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-02 16:34
I think the documentation is correct as it stands; the question is what
a "distinct memory location" is. Wrt. reference count, this surely
refers to pointers; each pointer is at least 4 bytes, and pointers are
four-aligned. So for N bits address space, there can be at most 2**(N-2)
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49050
2009-01-02 16:34:08loewissetstatus: open -> closed
nosy: + loewis
resolution: wont fix
messages: + msg78835
2009-01-01 10:32:31execreate