[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_loader('bar') This is because

[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 <ore...@gmail.com>: -- keywords: +patch pull_requests: +3638 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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 <ore...@gmail.com>: -- 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 tra

[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', _current_indent_level=4

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

2017-09-16 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- keywords: +patch pull_requests: +3611 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

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

2017-09-16 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- components: +Interpreter Core -Extension Modules ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[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

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

2017-09-16 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- keywords: +patch pull_requests: +3606 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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 specified

[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, None, None) encoder

[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 <rep...@bugs.python.org> <https://bugs.python.org/i

[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 <ore...@gmail.com>: -- keywords: +patch pull_requests: +3587 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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 <ore...@gmail.com>: -- pull_requests: +3586 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31471> ___ _

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

2017-09-15 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 <rep...@bugs.python.org> <https://bugs.python.org/i

[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 <rep...@bugs.python.org> <https://bugs.p

[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 error

[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

[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 <ore...@gmail.com>: -- keywords: +patch pull_requests: +3570 stage: needs patch -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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

[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 <ore...@gmail.com>: -- keywords: +patch pull_requests: +3534 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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 tracker <

[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

[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

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

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

[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 is because

[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

[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 <ore...@gmail.com>: -- keywords: +patch pull_requests: +3489 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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', lineno=1

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

2017-09-10 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- keywords: +patch pull_requests: +3475 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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=Warning, filename='bar

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

2017-09-10 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- keywords: +patch pull_requests: +3467 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[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

[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 <rep...@bugs.python.org> <https://bugs.python.org/i

[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: !PyErr_Occurred

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

2017-08-31 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3301 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31315> ___ _

[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
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 is because

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

2017-08-31 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- components: +ctypes -Extension Modules ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

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

2017-08-31 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3299 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31311> ___ _

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

2017-08-31 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3298 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31311> ___ _

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

2017-08-31 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- 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 <rep...@bugs.pytho

[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 <rep...@bugs.python.org> <http://bugs.python.org/issue31311> ___ _

[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 PyCData_setstate

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

2017-08-30 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3287 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31291> ___ _

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-29 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3276 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31243> ___ _

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-29 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3275 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31243> ___ _

[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 to simply

[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 'exception

[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 because

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

2017-08-28 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3270 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31293> ___ _

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[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

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

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

2017-08-28 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3269 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31291> ___ _

[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): return 42

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

2017-08-27 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3259 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31285> ___ _

[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__'].get_source(module_globals

[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

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

2017-08-26 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3251 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28261> ___ _

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

2017-08-26 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3248 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28261> ___ _

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

2017-08-26 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3247 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31271> ___ _

[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))', but in 2.7, the implementat

[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 <rep...@bugs.python.org> <http://bugs.python.org/issue28261> ___ ___ Python-bugs-list mailing list

[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="rot13

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

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

2017-08-24 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3240 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31271> ___ _

[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

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

2017-08-24 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3237 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28261> ___ _

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

2017-08-22 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3218 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31229> ___ _

[issue31243] checks whether PyArg_ParseTuple returned a negative int

2017-08-21 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3208 ___ Python tracker <rep...@bugs.python.org> <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
Oren Milman added the comment: yes, soon. (just wanted to hear your opinion before doing that.) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[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 already

[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

[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 handles

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

2017-08-20 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3199 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29832> ___ _

[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

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

2017-08-18 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3181 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31236> ___ _

[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 >>> max(0, a=1, b=2, c

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

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

[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) -

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

2017-08-17 Thread Oren Milman
Changes by Oren Milman <ore...@gmail.com>: -- pull_requests: +3157 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28261> ___ _

[issue28332] keyword arguments

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

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

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

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

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

[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 TypeErr

[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

[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 <rep...@bugs.python.org> <http://bugs.

[issue31147] a suboptimal check in list_extend()

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

[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 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, mn); ... // self

[issue15988] Inconsistency in overflow error messages of integer argument

2017-08-04 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 <rep...@bugs.python.org>

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: ISTM that what's left is (except for my 7 sub-patches): - making the error messages of long_rshift and long_lshift consistent (waits for #29816) - deciding whether to open an issue for changing the type of errors PyLong_AsSize_t raises

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to mmap, posix, socket and select. (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests failed.) -- Added file

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to curses, stat, callproc (ctypes) and sequence_repeat (abstract). (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to time and re. (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests failed.) -- Added file: http

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to hashlib, lzma and pickle. (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests failed.) -- Added file: http

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-19 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to array. (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests failed.) -- Added file: http://bugs.python.org

[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-18 Thread Oren Milman
Oren Milman added the comment: Here is a patch including only changes related to formats using the 'c' specifier. (I ran the test module, and on my Windows 10, the same tests failed with and without my patches. However, on my Ubuntu 16.04 VM, none of the tests failed.) -- Added file

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

2017-03-18 Thread Oren Milman
Oren Milman added the comment: here is the patch updated according to your suggestions, Serhiy. however, I wonder about the case of a too large _length_. shouldn't we raise a MemoryError in such a case, in accordance with #29833? BTW, while inspecting code related to a too large _length_, I

<    1   2   3   4   >