[issue15988] Inconsistency in overflow error messages of integer argument

2017-08-03 Thread Oren Milman
Oren Milman added the comment: How do we proceed? should I update (if needed) each of the patches I uploaded in March to eliminate commit conflicts? or can someone review them as they are now? -- ___ Python tracker <http://bugs.python.org/issue15

[issue31147] a mostly useless check in list_extend()

2017-08-08 Thread Oren Milman
New submission from Oren Milman: in listobject.c, in case list_extend() receives an 'iterable' which isn't 'self' nor a tuple nor a list, we have the following (heavily edited for brevity): mn = Py_SIZE(self) + PyObject_LengthHint(iterable); list_resize(self,

[issue31187] suboptimal code in Py_ReprEnter()

2017-08-12 Thread Oren Milman
New submission from Oren Milman: in Objects/object.c, Py_ReprEnter() does the following: - try to retrieve the Py_Repr list from the thread-state dict. - in case the list is not in the dict, add it to the dict as an empty list. - check whether the received object is in the Py_Repr

[issue31147] a suboptimal check in list_extend()

2017-08-12 Thread Oren Milman
Changes by Oren Milman : -- title: a mostly useless check in list_extend() -> a suboptimal check in list_extend() ___ Python tracker <http://bugs.python.org/issu

[issue31147] a suboptimal check in list_extend()

2017-08-13 Thread Oren Milman
Oren Milman added the comment: thank you for the elaborate reply :) do you feel the same about changing the check to (Py_SIZE(self) < (self->allocated >> 1)) ? -- ___ Python tracker <http://bugs.python

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-16 Thread Oren Milman
Oren Milman added the comment: I replied to your comments in Rietveld, Serhiy. (http://bugs.python.org/review/28261) also, i found two places with a quite similar issue: - in Objects/exceptions.c in ImportError_init: >>> ImportError(1, 2, 3, 4, a=5, b=6, c=7) Traceback (mo

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-17 Thread Oren Milman
Oren Milman added the comment: After more looking, I found this issue in two more places: - in Modules/itertoolsmodule.c in product_new: >>> itertools.product(0, a=1, b=2, c=3, d=4, e=5, f=6) Traceback (most recent call last): File "", line 1, in TypeError:

[issue28332] silent truncations in socket.htons and socket.ntohs

2017-08-17 Thread Oren Milman
Changes by Oren Milman : -- title: Deprecated silent truncations in socket.htons and socket.ntohs. -> silent truncations in socket.htons and socket.ntohs ___ Python tracker <http://bugs.python.org/issu

[issue28332] keyword arguments

2017-08-17 Thread Oren Milman
Changes by Oren Milman : -- title: silent truncations in socket.htons and socket.ntohs -> keyword arguments ___ Python tracker <http://bugs.python.org/issu

[issue28332] Deprecated silent truncations in socket.htons and socket.ntohs.

2017-08-17 Thread Oren Milman
Changes by Oren Milman : -- title: keyword arguments -> Deprecated silent truncations in socket.htons and socket.ntohs. ___ Python tracker <http://bugs.python.org/issu

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-17 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3157 ___ Python tracker <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31229] wrong error messages when too many kwargs are received

2017-08-17 Thread Oren Milman
New submission from Oren Milman: Some functions produce wrong error messages in case they receive too many keyword arguments: - in Objects/exceptions.c - ImportError_init: >>> ImportError(1, 2, 3, 4, a=5, b=6, c=7) TypeError: ImportError() takes at most 2 arguments (3 given) -

[issue31229] wrong error messages when too many kwargs are received

2017-08-17 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch Added file: http://bugs.python.org/file47091/issue31229_ver1.diff ___ Python tracker <http://bugs.python.org/issue31

[issue31236] improve some error messages of min() and max()

2017-08-18 Thread Oren Milman
New submission from Oren Milman: currently, we have the following: >>> min(0, a=1) TypeError: 'a' is an invalid keyword argument for this function >>> max(0, a=1) TypeError: 'a' is an invalid keyword argument for this function >>>

[issue31236] improve some error messages of min() and max()

2017-08-18 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3181 ___ Python tracker <http://bugs.python.org/issue31236> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29843] errors raised by ctypes.Array for invalid _length_ attribute

2017-08-19 Thread Oren Milman
Oren Milman added the comment: I am not sure I understood your question, Igor. I compiled with https://github.com/python/cpython/pull/3006, and got: class T(ctypes.Array): _type_ = ctypes.c_int _length_ = 2 ** 1000 Traceback (most recent call last): File "&quo

[issue29832] Don't refer to getsockaddrarg in error messages

2017-08-20 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3199 ___ Python tracker <http://bugs.python.org/issue29832> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29832] Don't refer to getsockaddrarg in error messages

2017-08-20 Thread Oren Milman
Oren Milman added the comment: here is a dirty script to test my PR. the script contains tests to anything I managed to test using my Windows 10 and Ubuntu 16.04 VM, i.e. all of the changes, except for the 'unsupported CAN protocol' message, and the changes of the code that h

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-21 Thread Oren Milman
New submission from Oren Milman: according to the docs (https://docs.python.org/3.7/c-api/arg.html?highlight=pyarg_parsetuple#c.PyArg_ParseTuple), PyArg_ParseTuple returns true for success or false for failure. I also looked at the implementation in Python/getargs.c, and it seems that indeed

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-21 Thread Oren Milman
Oren Milman added the comment: it seems that I have missed some places which are part of this issue, at least in Modules/_io/textio.c (one of them is mentioned in #31243). also, when fixing these, we should also add a check before the call to PyArg_ParseTuple (in case such check doesn't al

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-21 Thread Oren Milman
Oren Milman added the comment: yes, soon. (just wanted to hear your opinion before doing that.) -- ___ Python tracker <http://bugs.python.org/issue31243> ___ ___

[issue31229] wrong error messages when too many kwargs are received

2017-08-21 Thread Oren Milman
Oren Milman added the comment: I already wrote a patch, but I thought it would be better to wait until #31236 is resolved. this is because #31236 would change the error messages of min() and max(), and test_call tests exact error messages in CFunctionCallsErrorMessages, which is where I thought

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-21 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3208 ___ Python tracker <http://bugs.python.org/issue31243> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31229] wrong error messages when too many kwargs are received

2017-08-22 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3218 ___ Python tracker <http://bugs.python.org/issue31229> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-24 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3237 ___ Python tracker <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
New submission from Oren Milman: currently, the following causes an assertion in Modules/_io/textio.c in _io_TextIOWrapper_write_impl() to fail: import codecs import io class BadEncoder(): def encode(self, dummy): return 42 def _get_bad_encoder(dummy): return BadEncoder

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3240 ___ Python tracker <http://bugs.python.org/issue31271> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
Oren Milman added the comment: Just checked on current 3.6 on my Windows 10. The assertion failes, and it is in line 1337. oh my. -- ___ Python tracker <http://bugs.python.org/issue31

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Oren Milman
Oren Milman added the comment: As Serhiy pointed out on github, the assertion failure can be easily reproduced by the following: import codecs import io rot13 = codecs.lookup("rot13") rot13._is_text_encoding = True t = io.TextIOWrapper(io.BytesIO(b'foo'), encoding=&

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-25 Thread Oren Milman
Oren Milman added the comment: sure -- ___ Python tracker <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Oren Milman
Oren Milman added the comment: all three versions do 'self->pending_bytes_count += PyBytes_GET_SIZE(b);', while 'b' is the object the encoder returned. in 3.6 and 3.7, the implementation of PyBytes_GET_SIZE() includes 'assert(PyBytes_Check(op))',

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3247 ___ Python tracker <http://bugs.python.org/issue31271> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-26 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3248 ___ Python tracker <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-26 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3251 ___ Python tracker <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31285] a SystemError and an assertion failure in warnings.warn_explicit()

2017-08-26 Thread Oren Milman
New submission from Oren Milman: 1. the following causes an assertion failure in Python/_warnings.c in show_warning(): import warnings class BadLoader: def get_source(self, fullname): class BadSource: def splitlines(self): return [42] return

[issue31285] a SystemError and an assertion failure in warnings.warn_explicit()

2017-08-26 Thread Oren Milman
Oren Milman added the comment: on a second thought, BadSource could be a subclass of str, so maybe we should just check whether module_globals['__loader__'].get_source(module_globals['__name__']).splitlines()[lineno-1] is a str, and whether module_globals['__loader__&#x

[issue31285] a SystemError and an assertion failure in warnings.warn_explicit()

2017-08-27 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3259 ___ Python tracker <http://bugs.python.org/issue31285> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
New submission from Oren Milman: on Windows, assuming the file 'foo.zip' exists, the following would cause an assertion failure in Modules/zipimport.c in zipimport_zipimporter_get_data_impl(): import zipimport class BadStr(str): def replace(self, old, new):

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3269 ___ Python tracker <http://bugs.python.org/issue31291> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31285] a SystemError and an assertion failure in warnings.warn_explicit()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: ISTM that your solution is better than mine, Serhiy, so I updated the PR. -- ___ Python tracker <http://bugs.python.org/issue31

[issue31293] crashes in multiply_float_timedelta() and in truedivide_timedelta_float()

2017-08-28 Thread Oren Milman
New submission from Oren Milman: both of the following true division and multiplication operations crash the interpreter: import datetime class BadFloat(float): def as_integer_ratio(self): return (1 << 1000) - 1 datetime.timedelta() / BadFloat() datetime.timedelta() * Ba

[issue31293] crashes in multiply_float_timedelta() and in truedivide_timedelta_float()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: i am working on a patch. BTW, is there anywhere a list of what counts as an extension module, and what counts as the interpreter core? -- ___ Python tracker <http://bugs.python.org/issue31

[issue31293] crashes in multiply_float_timedelta() and in truedivide_timedelta_float()

2017-08-28 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3270 ___ Python tracker <http://bugs.python.org/issue31293> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31293] crashes in multiply_float_timedelta() and in truedivide_timedelta_float()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: I guess you meant for me to check whether the following has any problem: import decimal class BadFloat(float): def as_integer_ratio(self): return 1 << 1000 decimal.Decimal.from_float(BadFloat()) so it doesn't crash. if IIUC, this is be

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: I understand that our goal is to make Python better, not to make me happier :) anyway, I haven't checked, but I am quite sure that similar code might crash the interpreter on a release build of Python. (just wanted to clarify that, as you used the term '

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: just checked, and indeed on my Windows 10 the original code I posted here crashes the interpreter. The patch in the PR undermines duck-typing, and that's why I added a comment there, stating I wasn't sure about the patch. an alternate solution would be

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-29 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3275 ___ Python tracker <http://bugs.python.org/issue31243> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-29 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3276 ___ Python tracker <http://bugs.python.org/issue31243> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31291] zipimport.zipimporter.get_data() crashes when path.replace() returns a non-str

2017-08-30 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3287 ___ Python tracker <http://bugs.python.org/issue31291> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31311] SystemError raised by PyCData_setstate() in case __dict__ is not a dict

2017-08-30 Thread Oren Milman
New submission from Oren Milman: The following code causes PyCData_setstate() (in Modules/_ctypes/_ctypes.c) to raise a SystemError: import ctypes class BadStruct(ctypes.Structure): def __dict__(self): pass BadStruct().__setstate__({}, b'foo') this is because PyCDat

[issue31311] SystemError raised by PyCData_setstate() in case __dict__ is not a dict

2017-08-30 Thread Oren Milman
Oren Milman added the comment: typo - change the format to "O!s#" -- ___ Python tracker <http://bugs.python.org/issue31311> ___ ___ Python-bugs-l

[issue31311] a SystemError and a crash in PyCData_setstate() when __dict__ is bad

2017-08-31 Thread Oren Milman
Changes by Oren Milman : -- title: SystemError raised by PyCData_setstate() in case __dict__ is not a dict -> a SystemError and a crash in PyCData_setstate() when __dict__ is bad ___ Python tracker <http://bugs.python.org/issu

[issue31311] a SystemError and a crash in PyCData_setstate() when __dict__ is bad

2017-08-31 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3298 ___ Python tracker <http://bugs.python.org/issue31311> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31311] a SystemError and a crash in PyCData_setstate() when __dict__ is bad

2017-08-31 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3299 ___ Python tracker <http://bugs.python.org/issue31311> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31311] a SystemError and a crash in PyCData_setstate() when __dict__ is bad

2017-08-31 Thread Oren Milman
Changes by Oren Milman : -- components: +ctypes -Extension Modules ___ Python tracker <http://bugs.python.org/issue31311> ___ ___ Python-bugs-list mailin

[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure in get_encoded_name(), which is called by _PyImport_LoadDynamicModuleWithSpec() (in Python/importdl.c): import imp class BadSpec: name = 42 origin = 'foo' imp.create_dynamic(BadSpec()) this

[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman
Oren Milman added the comment: do you mean that we should fix it to raise a TypeError? the assertion is there, but not explicitly. get_encoded_name() calls PyUnicode_FindChar(), which calls PyUnicode_READY(), which does assert(_PyUnicode_CHECK). so i get: >>> import imp >>>

[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3301 ___ Python tracker <http://bugs.python.org/issue31315> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31404] undefined behavior and crashes in case of a bad sys.modules

2017-09-09 Thread Oren Milman
New submission from Oren Milman: at least on my Windows, the following code: import sys sys.modules = [] - when run interactively, causes weird behavior, e.g. exit() doesn't exit the interpreter, and print() doesn't print. then, pressing Ctrl+C causes 'Assertion failed:

[issue31311] a SystemError and a crash in PyCData_setstate() when __dict__ is bad

2017-09-10 Thread Oren Milman
Oren Milman added the comment: just in case it was missed - I have opened two PRs for this issue. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Oren Milman
New submission from Oren Milman: The following code crashes the interpreter: import decimal import fractions class BadRational(fractions.Fraction): numerator = None denominator = 42 decimal.Decimal() < BadRational() this is because numerator_as_decimal() (in Modules/_deci

[issue31406] crashes when comparing between a Decimal object and a bad Rational object

2017-09-10 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3467 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31406> ___ ___ Py

[issue31411] SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict

2017-09-10 Thread Oren Milman
New submission from Oren Milman: The following code causes warn_explicit() (in Python/_warnings.c) to raise a SystemError: import warnings warnings.filterwarnings('once') warnings.onceregistry = None warnings.warn_explicit(message='foo', category=Wa

[issue31411] SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict

2017-09-10 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3475 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31411> ___ ___ Py

[issue31416] assertion failures in warn_explicit() in case of a bad warnings.filters or warnings.defaultaction

2017-09-11 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure in warn_explicit() (in Python/_warnings.c): import warnings warnings.filters = [(None, None, Warning, None, 0)] warnings.warn_explicit(message='foo', category=Warning, filename='bar',

[issue31416] assertion failures in warn_explicit() in case of a bad warnings.filters or warnings.defaultaction

2017-09-11 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3489 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31416> ___ ___ Py

[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-11 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure in PyErr_WriteUnraisable() (in Python/errors.c): class BadException(Exception): __module__ = None class BadClass: def __del__(self): raise BadException foo = BadClass() del foo this is because

[issue31428] ElementTree.Element.__deepcopy__() raises a SystemError in case of a bad memo

2017-09-12 Thread Oren Milman
New submission from Oren Milman: The following code causes ElementTree.Element.__deepcopy__() to raise a SystemError: class BadMemo: def get(*args): return None import xml.etree.ElementTree xml.etree.ElementTree.Element('foo').__deepcopy__(BadMemo()) this

[issue31428] ElementTree.Element.__deepcopy__() raises a SystemError in case of a bad memo

2017-09-12 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3507 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue31442] assertion failures on Windows in Python/traceback.c in case of a bad io.open

2017-09-13 Thread Oren Milman
New submission from Oren Milman: the following code causes an assertion failure on my Windows: import io def _bad_open(*args): return 42 io.open = _bad_open 1/0 this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that the return value of io.open() is valid. IIUC, this

[issue31444] ResourceWarning in Python/traceback.c in case of a bad io.TextIOWrapper

2017-09-13 Thread Oren Milman
New submission from Oren Milman: the following code causes a ResourceWarning: import io def _bad_TextIOWrapper(*args): return None io.TextIOWrapper = _bad_TextIOWrapper 1/0 this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that io.TextIOWrapper() returned a stream

[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman
Oren Milman added the comment: what do you mean by 'Implicit converting to str can raise a warning or exception if __module__ is a bytes object.'? should we treat __module__ differently in case it is a bytes object? -- ___ Python track

[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3534 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31418> ___ ___ Py

[issue31471] assertion failure in subprocess.Popen() in case the env arg has a bad keys() method

2017-09-14 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure on Windows: class BadEnv(dict): keys = None import subprocess import sys subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv()) this is because getenvironment() (in Modu

[issue31471] assertion failure in subprocess.Popen() in case the env arg has a bad keys() method

2017-09-14 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3570 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-09-14 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure: class BadInt(int): def __abs__(self): return None import random random.seed(BadInt()) this is because random_seed() (in Modules/_randommodule.c) assumes that PyNumber_Absolute() returned an int, and

[issue31471] assertion failure in subprocess.Popen() in case the env arg has a bad keys() method

2017-09-14 Thread Oren Milman
Oren Milman added the comment: in 2.7 getenvironment() is in PC/_subprocess.c, and it also calls PyMapping_Values() immediately after calling PyMapping_Keys(). however, _PyObject_FastCallDict() doesn't exist here. in case of an error in both PyMapping_Keys() and PyMapping_Values(), the err

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-09-14 Thread Oren Milman
Oren Milman added the comment: sure. but what about the TypeError message? should it complain about the return value of abs(seed)? (the docs of random.seed don't mention abs().) -- ___ Python tracker <https://bugs.python.org/is

[issue31471] assertion failure in subprocess.Popen() in case the env arg has a bad keys() method

2017-09-14 Thread Oren Milman
Oren Milman added the comment: OK. but there isn't an assertion failure to test in 2.7, so is adding a test still relevant? -- ___ Python tracker <https://bugs.python.org/is

[issue31471] assertion failure in subprocess.Popen() in case the env arg has a bad keys() method

2017-09-15 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3586 ___ Python tracker <https://bugs.python.org/issue31471> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-09-15 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3587 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31478> ___ ___ Py

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-09-15 Thread Oren Milman
Oren Milman added the comment: i opened a PR that implements the first option, but of course I wouldn't mind if you decide another option is better. -- ___ Python tracker <https://bugs.python.org/is

[issue31486] calling a _json.Encoder object raises a SystemError in case obj.items() returned a tuple

2017-09-15 Thread Oren Milman
New submission from Oren Milman: the following code causes a SystemError: import json.encoder class BadDict(dict): def items(self): return () encoder = json.encoder.c_make_encoder(None, None, None, None, 'foo', 'bar', True,

[issue31490] assertion failure in ctypes in case an _anonymous_ attr appears outside _fields_

2017-09-16 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure: import ctypes class BadStruct(ctypes.Structure): _fields_ = [] _anonymous_ = ['foo'] foo = None this is because MakeAnonFields() (in Modules/_ctypes/stgdict.c) goes over the names sp

[issue31490] assertion failure in ctypes in case an _anonymous_ attr appears outside _fields_

2017-09-16 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3606 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31490> ___ ___ Py

[issue31492] assertion failures in case a module has a bad __name__ attribute

2017-09-16 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure: import os os.__name__ = None os.does_not_exist this is because module_getattro() (in Objects/moduleobject.c) assumes that __name__ is a string, and passes it to PyErr_Format(), which asserts it is a string. if we

[issue31492] assertion failures in case a module has a bad __name__ attribute

2017-09-16 Thread Oren Milman
Changes by Oren Milman : -- components: +Interpreter Core -Extension Modules ___ Python tracker <https://bugs.python.org/issue31492> ___ ___ Python-bugs-list m

[issue31492] assertion failures in case a module has a bad __name__ attribute

2017-09-16 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3611 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31492> ___ ___ Py

[issue31505] assertion failure in _json.make_encoder() in case of a bad encoder() argument

2017-09-18 Thread Oren Milman
New submission from Oren Milman: The following code causes an assertion failure: import _json def _bad_encoder(*args): return None enc = _json.make_encoder(None, None, _bad_encoder, None, 'foo', 'bar', None, None, None) enc(obj='spam&

[issue31505] assertion failure in json, in case _json.make_encoder() received a bad encoder() argument

2017-09-18 Thread Oren Milman
Changes by Oren Milman : -- title: assertion failure in _json.make_encoder() in case of a bad encoder() argument -> assertion failure in json, in case _json.make_encoder() received a bad encoder() argument ___ Python tracker <

[issue31505] assertion failure in json, in case _json.make_encoder() received a bad encoder() argument

2017-09-18 Thread Oren Milman
Changes by Oren Milman : -- keywords: +patch pull_requests: +3638 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31505> ___ ___ Py

[issue31531] crash and SystemError in case of a bad zipimport._zip_directory_cache

2017-09-20 Thread Oren Milman
New submission from Oren Milman: The following code causes the interpreter to crash (in case 'foo.zip' exists): import zipimport zipimport._zip_directory_cache['foo.zip'] = None importer = zipimport.zipimporter('foo.zip') importer.find_

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-04 Thread Oren Milman
New submission from Oren Milman: I am not sure whether such a platform exists, but on a platform where SIZEOF_VOID_P < SIZEOF_LONG, PyLong_AsVoidPtr (which is in Objects/longobject.c) is: long x; if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0) x = PyLong_AsLong

[issue29730] unoptimal calls to PyNumber_Check

2017-03-05 Thread Oren Milman
New submission from Oren Milman: current state if (PyNumber_Check(obj)) { someVar = PyNumber_AsSsize_t(obj, SomeError); if (someVar == -1 && PyErr_Occurred()) { return errVal; } } else { PyErr_Format(PyExc_TypeError,

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Oren Milman
New submission from Oren Milman: current state import io class IntLike(): def __init__(self, num): self._num = num def __index__(self): return self._num __int__ = __index__ io.StringIO('blah blah').read(IntLike(2)) io.StringIO(

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Oren Milman
Oren Milman added the comment: I don't have a use case for that. (I noticed this behavior by chance, while working on some other issue.) However, IIUC, commit 4fa88fa0ba35e25ad9be66ebbdaba9aca553dc8b, by Benjamin Peterson, Antoine Pitrou and Amaury Forgeot d'Arc, includes pa

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-07 Thread Oren Milman
Oren Milman added the comment: using _PyIO_ConvertSsize_t sounds great. with regard to tests for accepting integer types in other classes, there aren't a lot of them, so I guess it is not always tested. still, it is tested in (excluding tests of the actual feature of treating integer typ

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-07 Thread Oren Milman
Oren Milman added the comment: also with regard to adding tests, consider the following scenario: in the future, someone writes a patch for these functions, which makes them not accept integer types anymore. assuming the tests don't exist, the writer of the patch doesn't realize the p

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman
Oren Milman added the comment: I wrote a patch, but I attach it here and not in a PR, as you haven't approved adding tests. (I would be happy to open a PR with or without the tests.) I ran the test module (on my Windows 10), and seems like the patch doesn't break anything. also, whi

[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman
Oren Milman added the comment: should I open a PR (even though we didn't give Florent enough time to respond)? -- ___ Python tracker <http://bugs.python.org/is

  1   2   3   4   >