Issue 1511381: codec_getstreamcodec passes extra None (original) (raw)

Issue1511381

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/43541

classification

Title: codec_getstreamcodec passes extra None
Type: Stage:
Components: Unicode Versions: Python 2.5

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: hyeshik.chang Nosy List: doerwalter, hyeshik.chang
Priority: high Keywords:

Created on 2006-06-23 15:00 by hyeshik.chang, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getstreamcodec.diff hyeshik.chang,2006-06-23 15:00 patch to codec_getstreamcodec
Messages (4)
msg28873 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2006-06-23 15:00
codec_getstreamcodec passes a None object (null pointer, originally) as a "error" argument when errors is given as a null pointer. Due to this behavior, parsers can't utilize cjkcodecs which doesn't allow None as a default argument: SyntaxError: encoding problem: with BOM Attached patch fixes it to omit the argument, "errors", and changed it to use PyObject_CallFunction instead of PyEval_CallFunction because PyEval_CallFunction doesn't work for simple "O" argument. (I don't know it was intended. But we can still use PyEval_CallFunction if we write it as "(O)") I wonder if there's a reason that you chose PyEval_CallFunction for the initialization order or something? How to reproduce the error: echo "# coding: cp949" > test.py ./python test.py
msg28874 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2006-06-23 15:47
Logged In: YES user_id=89016 The patch looks good to me. Switching from PyEval_CallFunction() to PyObject_CallFunction() should be OK. (There seems to be subtle differences between the two, but finding out what it is looks like a scavenger hunt to me :-/)). So go ahead and check it in.
msg28875 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2006-06-23 21:18
Logged In: YES user_id=55188 Committed as r47086. Thanks for the review! :)
msg28876 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2006-06-26 09:29
Logged In: YES user_id=89016 Closing the patch
History
Date User Action Args
2022-04-11 14:56:18 admin set github: 43541
2006-06-23 15:00:23 hyeshik.chang create