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

2017-09-28 Thread Oren Milman
Oren Milman added the comment: oh, of course, checking that get_source() returned a string before passing it to str.splitlines() is not needed. -- ___ Python tracker <https://bugs.python.org/issue31

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

2017-09-29 Thread Oren Milman
Oren Milman added the comment: But in case get_source() returned a unicode, is it likely that the splitlines() method of this unicode would return a 8-bit string? Currently show_warning() doesn't handle this scenario, as it assumes splitlines() returned an 8-bit string. Or do you think

[issue31637] integer overflow in the size of a ctypes.Array

2017-09-29 Thread Oren Milman
New submission from Oren Milman : The following code: from ctypes import * from _testcapi import PY_SSIZE_T_MAX, LONG_MAX if LONG_MAX == PY_SSIZE_T_MAX == (1 << 31) - 1: class MyArray(Array): _type_ = c_longlong _length_ = 1 << 29 arr = MyArray() for

[issue31637] integer overflow in the size of a ctypes.Array

2017-09-29 Thread Oren Milman
Oren Milman added the comment: oh, i missed that. sorry. -- ___ Python tracker <https://bugs.python.org/issue31637> ___ ___ Python-bugs-list mailing list Unsub

[issue31637] integer overflow in the size of a ctypes.Array

2017-09-29 Thread Oren Milman
Change by Oren Milman : -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue31637> ___ ___

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

2017-09-29 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3807 ___ Python tracker <https://bugs.python.org/issue29843> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2017-09-29 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3808 ___ Python tracker <https://bugs.python.org/issue31285> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28280] Always return a list from PyMapping_Keys/PyMapping_Values/PyMapping_Items

2017-09-29 Thread Oren Milman
Oren Milman added the comment: I would be happy to write a PR that implements that. However, i am not sure which way is better to construct a list from the return value (an iterable, hopefully) of keys() etc.: - Call PyList_Type() (in each of PyMapping_Keys() etc.) on the iterable, and

[issue28280] Always return a list from PyMapping_Keys/PyMapping_Values/PyMapping_Items

2017-09-30 Thread Oren Milman
Oren Milman added the comment: (for knowledge preservation's sake) Resolving this issue would also resolve #31486. -- ___ Python tracker <https://bugs.python.org/is

[issue28280] Always return a list from PyMapping_Keys/PyMapping_Values/PyMapping_Items

2017-09-30 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3821 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue28280> ___ ___ Python-

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

2017-10-01 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3826 ___ Python tracker <https://bugs.python.org/issue31478> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21983] segfault in ctypes.cast

2017-10-01 Thread Oren Milman
Oren Milman added the comment: IMHO, Lib/ctypes/test/test_cast.py is the relevant test. Mark, do you still wish to provide a fix for that? (Otherwise, i would be happy to open a PR.) -- nosy: +Oren Milman ___ Python tracker <ht

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

2017-10-02 Thread Oren Milman
Oren Milman added the comment: Should i remove the code that i wasn't able to test from the PR, and leave such changes to someone that is able to test it? (of course, if there is some way i can do it using a VM, please point that out, and i would try to set up th

[issue21983] segfault in ctypes.cast

2017-10-02 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3839 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue21983> ___ ___ Python-

[issue21983] segfault in ctypes.cast

2017-10-02 Thread Oren Milman
Change by Oren Milman : -- versions: +Python 3.7 -Python 2.7, Python 3.4 ___ Python tracker <https://bugs.python.org/issue21983> ___ ___ Python-bugs-list mailin

[issue21983] segfault in ctypes.cast

2017-10-02 Thread Oren Milman
Change by Oren Milman : -- versions: +Python 2.7, Python 3.4 ___ Python tracker <https://bugs.python.org/issue21983> ___ ___ Python-bugs-list mailing list Unsub

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

2017-10-02 Thread Oren Milman
Oren Milman added the comment: sure -- ___ Python tracker <https://bugs.python.org/issue31271> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2017-10-02 Thread Oren Milman
Oren Milman added the comment: I am not sure, but ISTM that it isn't possible for the encoder to return a unicode and not fail later. This is because _textiowrapper_writeflush() would call _io.BytesIO.write() (after it called _PyBytes_Join()), and bytesio_write() calls PyObject_GetB

[issue31683] a stack overflow on windows in faulthandler._fatal_error()

2017-10-03 Thread Oren Milman
New submission from Oren Milman : On my 64-bit Windows 10, the echo here would print -1073741571: python -c "import faulthandler; faulthandler._fatal_error(b'a' * 2 ** 22)" echo %errorlevel% This is code c0fd, which windbg describes as 'Stack overflow'. This

[issue31092] multiprocessing.Manager() race condition

2017-10-05 Thread Oren Milman
Oren Milman added the comment: IIUC: In Lang's example, doing `queue = None` caused the destruction of the shared queue, which caused a call to BaseProxy._decref() (in multiprocessing/managers.py), which dispatched a decref request to the manager's server process. Meanwhile, the poo

[issue31092] multiprocessing.Manager() race condition

2017-10-05 Thread Oren Milman
Oren Milman added the comment: Prof Plum, i changed the type of the issue to 'behavior', because Lang and me both got a KeyError. if your interpreter actually crashed, please change it back to 'crash'. -- ___ Python tracker <

[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread Oren Milman
Oren Milman added the comment: Here is some similar code that crashes for the same reasons: # create a circular reference with a malicious __del__(). class A: def __del__(*args): del list1[0] circ_ref_obj = A() circ_ref_obj._self = circ_ref_obj list1 = [None] list2 = [] del

[issue31092] multiprocessing.Manager() race condition

2017-10-06 Thread Oren Milman
Oren Milman added the comment: Davin and Antoine, i added you to the nosy list because you are listed as multiprocessing experts :) -- nosy: +davin, pitrou ___ Python tracker <https://bugs.python.org/issue31

[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread Oren Milman
Oren Milman added the comment: Oh, and calls to PyObject_GC_NewVar() might also cause similar issues. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Oren Milman
New submission from Oren Milman : Given an uninitialized IncrementalNewlineDecoder: uninitialized = io.IncrementalNewlineDecoder.__new__(io.IncrementalNewlineDecoder) each of the following calls would raise a SystemError ('null argument to internal routine'): uninitialize

[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Oren Milman
Oren Milman added the comment: Yes, although i don't know if there are usecases for that. -- ___ Python tracker <https://bugs.python.org/issue31718> ___ ___

[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-07 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3886 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31718> ___ ___ Python-

[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-07 Thread Oren Milman
Oren Milman added the comment: With regard to refleaks in __init__() methods, i started looking for similar refleaks in the codebase, and hope to open an issue to fix them soon. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31721] assertion failure in FutureObj_finalize() after setting _log_traceback to True

2017-10-07 Thread Oren Milman
New submission from Oren Milman : The following code causes an assertion failure in FutureObj_finalize() (in Modules/_asynciomodule.c): import asyncio asyncio.Future()._log_traceback = True Maybe we should allow Python code to only set it to False, and raise a ValueError in case Python code

[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-07 Thread Oren Milman
New submission from Oren Milman : The following code causes refleaks: import zipimport zi = zipimport.zipimporter.__new__(zipimport.zipimporter) zi.__init__('bar.zip') zi.__init__('bar.zip') zi.__init__('bar.zip\\foo') This is because zipimport_zipimport

[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-07 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3892 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31723> ___ ___ Python-

[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-08 Thread Oren Milman
New submission from Oren Milman : The following code causes the interpreter to crash: import xml.etree.ElementTree class X: def __del__(self): elem.clear() elem = xml.etree.ElementTree.Element('elem') elem.text = X() elem.clear() This is because _elementtree_Element_

[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-08 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3897 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31728> ___ ___ Python-

[issue31734] crash or SystemError in sqlite3.Cache in case it is uninitialized or partially initialized

2017-10-09 Thread Oren Milman
New submission from Oren Milman : The following code causes a crash: import sqlite3 cache = sqlite3.Cache.__new__(sqlite3.Cache) cache.get(None) This is because pysqlite_cache_get() (in Modules/_sqlite/cache.c) assumes that the Cache object is initialized, and so it passes self->mapping

[issue31734] crash or SystemError in sqlite3.Cache in case it is uninitialized or partially initialized

2017-10-09 Thread Oren Milman
Oren Milman added the comment: Also, the following code results in a memory leak: import sqlite3 cache = sqlite3.Cache.__new__(sqlite3.Cache) This is because pysqlite_cache_dealloc() just returns in case of an uninitialized Cache object

[issue31723] refleaks in zipimport when calling zipimporter.__init__() more than once

2017-10-09 Thread Oren Milman
Oren Milman added the comment: Yes, i am going manually over the code to find similar stuff to #31718, and i afraid i found quite a few, and still working on it.. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31734] crash or SystemError in sqlite3.Cache in case it is uninitialized or partially initialized

2017-10-09 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3912 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31734> ___ ___ Python-

[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-09 Thread Oren Milman
New submission from Oren Milman : The following code causes refleaks: import sqlite3 connection = sqlite3.Connection.__new__(sqlite3.Connection) connection.__init__('foo') connection.__init__('foo') This is because pysqlite_connection_init() (in Modules/_sqlite/connection.c

[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-09 Thread Oren Milman
Oren Milman added the comment: Ah, here also there are crashes when calling methods of uninitialized connection objects. Should i fix this as part of this issue, or open another one? -- ___ Python tracker <https://bugs.python.org/issue31

[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-09 Thread Oren Milman
Oren Milman added the comment: As serhiy pointed out in a comment in PR 3924, setting self->text or self->tail to NULL might lead to an assertion failure, so we should also prevent the following assertion failure (and the similar one for tail): import xml.etree.ElementTree class X:

[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3917 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31740> ___ ___ Python-

[issue31746] crashes in sqlite3.Connection in case it is uninitialized or partially initialized

2017-10-10 Thread Oren Milman
New submission from Oren Milman : The following code causes a crash: import sqlite3 connection = sqlite3.Connection.__new__(sqlite3.Connection) connection.isolation_level This is because pysqlite_connection_get_isolation_level() doesn't check whether the Connection object is initia

[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread Oren Milman
Oren Milman added the comment: (opened bpo-31746 for the crashes i mentioned) -- ___ Python tracker <https://bugs.python.org/issue31740> ___ ___ Python-bug

[issue31722] _io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder

2017-10-10 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3918 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31722> ___ ___ Python-

[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3925 stage: backport needed -> patch review ___ Python tracker <https://bugs.python.org/issue31728> ___ ___ Python-

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

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3926 stage: backport needed -> patch review ___ Python tracker <https://bugs.python.org/issue31271> ___ ___ Python-

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

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3927 stage: resolved -> patch review ___ Python tracker <https://bugs.python.org/issue31490> ___ ___ Python-bugs-lis

[issue31758] various refleaks in _elementtree

2017-10-11 Thread Oren Milman
New submission from Oren Milman : The following code results in refleaks: import sys import _elementtree builder = _elementtree.TreeBuilder() parser = _elementtree.XMLParser(target=builder) refcount_before = sys.gettotalrefcount() parser.__init__(target=builder) print(sys.gettotalrefcount

[issue31758] various refleaks in _elementtree

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3931 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue31764] sqlite3.Cursor.close() crashes in case the Cursor object is uninitialized

2017-10-11 Thread Oren Milman
New submission from Oren Milman : The following code causes a crash: import sqlite3 cursor = sqlite3.Cursor.__new__(sqlite3.Cursor) cursor.close() this is because pysqlite_cursor_close() (in Modules/_sqlite/cursor.c) assumes that `self->connection` is not NULL, and passes it

[issue31764] sqlite3.Cursor.close() crashes in case the Cursor object is uninitialized

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3934 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31764> ___ ___ Python-

[issue31770] crash and refleaks when calling sqlite3.Cursor.__init__() more than once

2017-10-12 Thread Oren Milman
New submission from Oren Milman : The following code crashes: import sqlite3 import weakref def callback(*args): pass connection = sqlite3.connect(":memory:") cursor = sqlite3.Cursor(connection) ref = weakref.ref(cursor, callback) cursor.__init__(connection) del cursor del ref

[issue31770] crash and refleaks when calling sqlite3.Cursor.__init__() more than once

2017-10-12 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3946 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31770> ___ ___ Python-

[issue31758] various refleaks in _elementtree

2017-10-13 Thread Oren Milman
Oren Milman added the comment: Shame on me. I only now found out that Serhiy already mentioned most of the refleaks in https://bugs.python.org/issue31455#msg302103. -- ___ Python tracker <https://bugs.python.org/issue31

[issue31455] ElementTree.XMLParser() mishandles exceptions

2017-10-13 Thread Oren Milman
Oren Milman added the comment: Serhiy, in addition to the problems you mentioned with not calling __init__(), it seems that calling every method of an uninitialized XMLParser object would crash. If you don't mind, i would be happy to open an issue to fix these crashes. -- nosy:

[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2017-10-13 Thread Oren Milman
New submission from Oren Milman : The following code causes an assertion failure: import _struct struct_obj = _struct.Struct.__new__(_struct.Struct) struct_obj.iter_unpack(b'foo') This is because Struct_iter_unpack() (in Modules/_struct.c) assumes that Struct.__init__()

[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2017-10-13 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3960 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31779> ___ ___ Python-

[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-13 Thread Oren Milman
New submission from Oren Milman : The following code crashes: import zipimport zi = zipimport.zipimporter.__new__(zipimport.zipimporter) zi.find_module('foo') This is because get_module_info() (in Modules/zipimport.c) assumes that the zipimporter object is initialized, so it assumes

[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-13 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3962 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31781> ___ ___ Python-

[issue31787] various refleaks when calling the __init__() method of an object more than once

2017-10-14 Thread Oren Milman
New submission from Oren Milman : Various __init__() methods don't decref (if needed) before assigning to fields of the object's struct (i.e. assigning to `self->some_field`): - _asyncio_Task___init___impl() (in Modules/_asynciomodule.c) - _lzma_LZMADecompressor___init___impl(

[issue31787] various refleaks when calling the __init__() method of an object more than once

2017-10-14 Thread Oren Milman
Change by Oren Milman : -- keywords: +patch pull_requests: +3971 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31787> ___ ___ Python-

[issue31758] various refleaks in _elementtree, and crashes when using an uninitialized XMLParser object

2017-10-14 Thread Oren Milman
Oren Milman added the comment: According to Serhiy's advice (https://bugs.python.org/issue31455#msg304338), this issue now also includes some crashes in _elementtree: The following code crashes: import _elementtree parser = _elementtree.XMLParser.__new__(_elementtree.XMLParser) parser.

[issue31758] various refleaks in _elementtree, and crashes when using an uninitialized XMLParser object

2017-10-14 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3972 ___ Python tracker <https://bugs.python.org/issue31758> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2017-10-21 Thread Oren Milman
Oren Milman added the comment: ISTM that PR 3840 resolved this issue (as part of bpo-28280). -- ___ Python tracker <https://bugs.python.org/issue31486> ___ ___

[issue31839] datetime: add method to parse isoformat() output

2017-10-21 Thread Oren Tirosh
New submission from Oren Tirosh : The object types in the datetime module can produce a standard string representation (rfc3339, a subset of iso8601) but they do not provide a method to parse it. Proposed method names: isoparse or fromisoformat. In addition, a constructor call with a single

[issue31764] sqlite3.Cursor.close() crashes in case the Cursor object is uninitialized

2017-11-08 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +4288 ___ Python tracker <https://bugs.python.org/issue31764> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31764] sqlite3.Cursor.close() crashes in case the Cursor object is uninitialized

2017-11-08 Thread Oren Milman
Oren Milman added the comment: I opened #4333 for 2.7, but it is quite straightforward.. Am i missing something? -- ___ Python tracker <https://bugs.python.org/issue31

[issue9035] os.path.ismount on windows doesn't support windows mount points

2010-06-20 Thread Oren Held
New submission from Oren Held : On unices, ismount checks whether the given path is a mount point. On windows, it only checks whether it's a drive letter. Long story short, Python simply returns False when doing ismount(r"c:\mount1"), while c:\mount1 is a real mount point. T

[issue28129] assertion failures in ctypes

2017-03-01 Thread Oren Milman
Oren Milman added the comment: The fix for issue #25659 already replaced the assertions in CDataType_from_buffer and CDataType_from_buffer_copy with if statements (my bad for missing that issue when I opened this one). In addition, that fix added some tests, so I also added some, and created a

[issue28272] a redundant check in maybe_small_long

2017-03-01 Thread Oren Milman
Oren Milman added the comment: ping (just to close the issue, I think) -- ___ Python tracker <http://bugs.python.org/issue28272> ___ ___ Python-bugs-list mailin

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +323 ___ Python tracker <http://bugs.python.org/issue27298> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Oren Milman added the comment: I created a pull request (https://github.com/python/cpython/pull/392) to fix the mistakes in _testcapimodule, but didn't mention this issue in the pull request's title, as the issue mentioned these mistakes only as a

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Oren Milman added the comment: the pull request was merged, so I guess we can close this issue.. -- ___ Python tracker <http://bugs.python.org/issue27298> ___ ___

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

2017-03-02 Thread Oren Milman
Oren Milman added the comment: Do you mean that in each case PyArg_ParseTuple fails, we should chain to the exception raised by PyArg_ParseTuple an exception that specifies the name of the tuple that PyArg_ParseTuple failed to parse, without specifying the function name

[issue28272] a redundant check in maybe_small_long

2017-03-02 Thread Oren Milman
Oren Milman added the comment: So, should I open a pull request? (as some time had passed, I would also run again the tests, etc.) -- ___ Python tracker <http://bugs.python.org/issue28

[issue28298] can't set big int-like objects to items in array 'Q', 'L' and 'I'

2017-03-02 Thread Oren Milman
Oren Milman added the comment: ping -- ___ Python tracker <http://bugs.python.org/issue28298> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned

2016-05-28 Thread Oren Milman
New submission from Oren Milman: the current state >>> if is32BitCPython: ... PyLong_SHIFT = 15 ... elif is64BitCPython: ... PyLong_SHIFT = 30 ... >>> # case A # >>> a = 2 ** PyLong_SHIFT - 1 >>> b = 2 ** PyLong_SHIFT

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned

2016-05-28 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43042/CPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27145> ___ ___ Python-bug

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned

2016-05-28 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43043/patchedCPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27145> ___ ___ Pytho

[issue27073] redundant checks in long_add and long_sub

2016-05-28 Thread Oren Milman
Oren Milman added the comment: After giving it some more thought (while working on another, somewhat related issue - http://bugs.python.org/issue27145), I realized that that assert in long_add could further verify that the int x_add returned is a multiple-digit int (as x_add had received two

[issue27073] redundant checks in long_add and long_sub

2016-05-28 Thread Oren Milman
Oren Milman added the comment: And after quadruple checking myself, I found a foolish mistake - in that flow, x_add received at least one multiple-digit int (not necessarily two :(). I fixed that mistake in the comment. The updated diff file is attached. -- Added file: http

[issue27073] redundant checks in long_add and long_sub

2016-05-29 Thread Oren Milman
Oren Milman added the comment: I agree. This assert only indirectly verifies that something bad doesn't happen. The bad thing that might happen is an in-place negating of an element of small_ints, so the most direct assert should be 'assert(Py_REFCNT(z) == 1);'. This is exac

[issue27073] redundant checks in long_add and long_sub

2016-06-03 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43145/patchedCPythonTestOutput2.txt ___ Python tracker <http://bugs.python.org/issue27073> ___ ___ Pytho

[issue27073] redundant checks in long_add and long_sub

2016-06-03 Thread Oren Milman
Oren Milman added the comment: All right. The updated diff file is attached. I compiled and ran the tests again. They are quite the same. The test output is attached. -- Added file: http://bugs.python.org/file43144/issue27073.diff ___ Python

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned

2016-06-03 Thread Oren Milman
Oren Milman added the comment: I just realized I had forgotten to check for a failure after using _PyLong_Negate. The updated diff file is attached. -- Added file: http://bugs.python.org/file43148/proposedPatches.diff ___ Python tracker <h

[issue27145] long_add and long_sub might return a new int where &small_ints[x] could be returned

2016-06-03 Thread Oren Milman
Oren Milman added the comment: After giving it some more thought, I feel somewhat uncertain about that check for a failure after using _PyLong_Negate. At first I noticed that after every call to _PyLong_Negate there is such a check. But then I realized that in my patch, and also in long_mul

[issue27073] redundant checks in long_add and long_sub

2016-06-03 Thread Oren Milman
Oren Milman added the comment: I considered doing that, but I had already opened another issue (http://bugs.python.org/issue27145) in which I had proposed to replace that in-place negate in long_sub with a call to _PyLong_Negate. But I guess I shouldn't worry about my patches coll

[issue27073] redundant checks in long_add and long_sub

2016-06-03 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43164/patchedCPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27073> ___ ___ Pytho

[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-06-04 Thread Oren Milman
New submission from Oren Milman: the current state long_invert first checks whether v is a single-digit int. If it is, it simply does 'return PyLong_FromLong(-(MEDIUM_VALUE(v) + 1));'. Otherwise, long_invert does (edited for brevity) 'x = long_add(v, Py

[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-06-04 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43188/patchedCPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27214> ___ ___ Pytho

[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-06-04 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43187/CPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27214> ___ ___ Python-bug

[issue27222] redundant checks and a weird use of goto statements in long_rshift

2016-06-04 Thread Oren Milman
New submission from Oren Milman: current state 1. long_rshift first checks whether a is a negative int. If it is, it does (edited for brevity) 'z = long_invert(long_rshift(long_invert(a), b));'. Otherwise, it calculates the result of the shift and stores i

[issue27222] redundant checks and a weird use of goto statements in long_rshift

2016-06-04 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43209/patchedCPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27222> ___ ___ Pytho

[issue27222] redundant checks and a weird use of goto statements in long_rshift

2016-06-04 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43208/CPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27222> ___ ___ Python-bug

[issue27111] redundant variables in long_add and long_sub

2016-06-05 Thread Oren Milman
Oren Milman added the comment: done. By the way, I am logging in to bugs.python.org through accounts.google.com, but I couldn't see any way to do the same in www.python.org, so I have a native account there (with the same email address). I hope that won't b

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43348/CPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27298> ___ ___ Python-bug

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
New submission from Oren Milman: current state 1. In Objects/longobject.c in _PyLong_AsUnsignedLongMask, in case v is a multiple-digit int, _PyLong_AsUnsignedLongMask iterates over all of its digits (going from the most to the least significant digit) and does (for

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43347/patchedCPythonTestOutput.txt ___ Python tracker <http://bugs.python.org/issue27298> ___ ___ Pytho

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-14 Thread Oren Milman
Oren Milman added the comment: Ah, that's a cool alternative to divide and ceil. I would change my patch accordingly. And would write the patch also for _PyLong_AsUnsignedLongLongMask, and work on some micro-benchmarking for it and _PyLong_AsUnsignedLongMask. Indeed _testcapimodule.c i

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman
Oren Milman added the comment: I did some micro-benchmarking, and it looks like bad news for my patch. I wrote a simple C extension in order to call PyLong_AsUnsignedLongMask and PyLong_AsUnsignedLongLongMask from Python code (attached). Then I ran the following micro-benchmarks using both the

<    1   2   3   4   >