- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
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.
| Author | vstinner |
|---|---|
| Recipients | vstinner |
| Date | 2021-01-08.09:28:39 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1610098119.51.0.27659926103.issue42866@roundup.psfhosted.org> |
| In-reply-to |
| Content |
|---|
$ ./python -m test test_multibytecodec -m test.test_multibytecodec.Test_IncrementalEncoder.test_subinterp -R 3:3
(...)
test_multibytecodec leaked [258, 258, 258] references, sum=774
I simplified the code. The following test leaks references:
def test_subinterp(self):
import _testcapi
code = textwrap.dedent("""
import _codecs_jp
codec = _codecs_jp.getcodec('cp932')
codec = None
""")
_testcapi.run_in_subinterp(code)
_codecs_jp.getcodec() is defined in Modules/cjkcodecs/cjkcodecs.h. Extract:
cofunc = getmultibytecodec();
...
codecobj = PyCapsule_New((void *)codec, PyMultibyteCodec_CAPSULE_NAME, NULL);
if (codecobj == NULL)
return NULL;
r = PyObject_CallOneArg(cofunc, codecobj);
Py_DECREF(codecobj);
getmultibytecodec() is the _multibytecodec.__create_codec() which is defined in Modules/cjkcodecs/multibytecodec.c. Simplified code:
codec = PyCapsule_GetPointer(arg, PyMultibyteCodec_CAPSULE_NAME);
_multibytecodec_state *state = _multibytecodec_get_state(module);
self = PyObject_New(MultibyteCodecObject, state->multibytecodec_type);
self->codec = codec;
return (PyObject *)self; |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-01-08 09:28:39 | vstinner | set | recipients: + vstinner |
| 2021-01-08 09:28:39 | vstinner | set | messageid: <1610098119.51.0.27659926103.issue42866@roundup.psfhosted.org> |
| 2021-01-08 09:28:39 | vstinner | link | issue42866 messages |
| 2021-01-08 09:28:39 | vstinner | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
