[issue26707] plistlib fails to parse bplist with 0x80 UID values

2016-04-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +ronaldoussoren, serhiy.storchaka type: crash -> behavior ___ Python tracker ___

[issue26388] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)

2016-04-06 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for the ping. The actual code changes look OK to me for the initially proposed design, which means the main missing piece would be documentation updates (both to the docstrings and to runpy module reference). However, thinking about how those docs might

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Martin Panter
Martin Panter added the comment: Yes, I think this is the expected behaviour, and I can’t think of any improvements that could be made. If you call fileno(), you have to ensure that you don’t close the file descriptor until you have finished using it. It is a bit like accessing memory after

[issue26388] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)

2016-04-06 Thread Mike Kaplinskiy
Mike Kaplinskiy added the comment: ping -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue26707] plistlib fails to parse bplist with 0x80 UID values

2016-04-06 Thread John Lehr
New submission from John Lehr: libplist raises an invalid file exception on loading properly formed binary plists containing UID (0x80) values. The binary files were tested for form with plutil. Comments at line 706 state the value is defined but not in use in plists, and the object is not

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread JoshN
JoshN added the comment: I do understand that the docs are a bit strange on the issue. For example, actually testing the line you referenced ("...fileno will return the same socket and not a duplicate.") by creating 2 sockets and testing sameness with the 'is' operator returns false. I tried

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: Here's an improved patch which: - passes the tests - puts the test in the correct place I'm not entirely happy with the approach -- open to suggestions :) -- Added file: http://bugs.python.org/file42387/patch2 ___

[issue18844] allow weights in random.choice

2016-04-06 Thread Steven Basart
Steven Basart added the comment: I reuploaded the file. The spacing on the if amount < 1 was off. Hopefully its fixed now. -- Added file: http://bugs.python.org/file42386/weighted_choice_v4.patch ___ Python tracker

[issue18844] allow weights in random.choice

2016-04-06 Thread Steven Basart
Changes by Steven Basart : Removed file: http://bugs.python.org/file42385/weighted_choice_v4.patch ___ Python tracker ___

[issue18844] allow weights in random.choice

2016-04-06 Thread Steven Basart
Steven Basart added the comment: Okay so I added a few lines of code. One to make it return a single number if amount == 1 and the other to check that the amount > 1. The main difference I've noticed between this implementation and previous versions compared to say R is that in R they

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Martin Panter
Martin Panter added the comment: Also, if you enable warnings (e.g. python -Wall), you should see that the socket is being closed: -c:22: ResourceWarning: unclosed -- ___ Python tracker

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Martin Panter
Martin Panter added the comment: The documentation already says “Sockets are automatically closed when they are garbage-collected”. If for some reason you want to release a socket object but keep the file descriptor open, I suggest socket.detach(). Otherwise, pass the original socket, not the

[issue18844] allow weights in random.choice

2016-04-06 Thread Westley Martínez
Westley Martínez added the comment: I still like Serhiy's implementation more. A function that returns a list instead of the item is unnatural and doesn't fit with the rest of the module. I think there's need to be some discussion about use cases. What do users actually want? Maybe post this

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: The root cause seems to be that autospecced functions return a function object (not a Mock instance) which a '.mock' attribute which is a MagicMock ( assigned here:

[issue26705] logging.Handler.handleError should be called from logging.Handler.handle

2016-04-06 Thread Vinay Sajip
Vinay Sajip added the comment: Thanks for the suggestion, but I'm not sure this can be accepted without violating backward compatibility. It forces each handler implementation to either accept the base implementation of handleError(), or to override it. And if there are existing handler

[issue26706] Update OpenSSL version in readme

2016-04-06 Thread Shaun Walbridge
New submission from Shaun Walbridge: Sync documentation with the OpenSSL version update (1.0.2g vs 1.0.2f). Mismatch present in both head and 3.5 branch. -- assignee: docs@python components: Documentation files: readme-openssl.diff keywords: patch messages: 262964 nosy: docs@python,

[issue26027] Support Path objects in the posix module

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is preliminary patch without tests. Writing tests will be tiresome. -- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file42382/path_converter_path.patch ___ Python

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
New submission from Anthony Sottile: Originally from https://github.com/testing-cabal/mock/issues/350 ## Example ```python from unittest import mock class C(object): def f(self): pass c = C() with mock.patch.object(c, 'f', autospec=True): with mock.patch.object(c, 'f',

[issue26705] logging.Handler.handleError should be called from logging.Handler.handle

2016-04-06 Thread Aviv Palivoda
New submission from Aviv Palivoda: Currently all the stdlib logging handlers (except BufferingHandler) emit method have the following structure: def emit(self, record): try: // do the emit except Exception: self.handleError(record) I suggest changing

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8dc144e47252 by Serhiy Storchaka in branch 'default': Issue #26671: Fixed #ifdef indentation. https://hg.python.org/cpython/rev/8dc144e47252 -- ___ Python tracker

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4acdb324a430 by Serhiy Storchaka in branch 'default': Issue #26671: Fixed #ifdef indentation. https://hg.python.org/cpython/rev/4acdb324a430 -- ___ Python tracker

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: For source reference, the behavior for this case is to just copy out the file descriptor and stick it in a new socket object ( https://hg.python.org/cpython/file/3.5/Modules/socketmodule.c#l4289 ); no work is being done to somehow collaboratively manage the

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: You used the `fileno` based initialization in the child, which creates a wrapper around the same file descriptor without duplicating it, so when the first socket disappears, that file descriptor becomes invalid. I think this is a doc bug more than a behavior

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your review Larry. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset a866f5727b7f by Serhiy Storchaka in branch 'default': Issue #26671: Enhanced path_converter. https://hg.python.org/cpython/rev/a866f5727b7f -- nosy: +python-dev ___ Python tracker

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Larry Hastings
Larry Hastings added the comment: LGTM. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here it is. -- Added file: http://bugs.python.org/file42380/path_converter_cleanup_3.patch ___ Python tracker ___

[issue23551] IDLE to provide menu link to PIP gui.

2016-04-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: It is wrong for Run Module to open a new shell window when there is a shell window already. But I am not seeing this today with IDLE restarted, so for now, forget about it. V4 is improved, but the list of installed packages is repeated and 2/3 repeated

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread SilentGhost
Changes by SilentGhost : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread JoshN
Changes by JoshN : -- title: Socket state corrupts when original assignment goes out of scope -> Socket state corrupts when original socket object goes out of scope in a different thread ___ Python tracker

[issue26703] Socket state corrupts when original assignment goes out of scope

2016-04-06 Thread JoshN
New submission from JoshN: Creating a socket in one thread and sharing it with another will cause the socket to corrupt as soon as the thread it was created in exits. Example code: import socket, threading, time, os def start(): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

[issue23551] IDLE to provide menu link to PIP gui.

2016-04-06 Thread Eric Khoo Jiun Hooi
Changes by Eric Khoo Jiun Hooi : Added file: http://bugs.python.org/file42379/pip_gui_v4.py ___ Python tracker ___

[issue26671] Clean up path_converter in posixmodule.c

2016-04-06 Thread Larry Hastings
Larry Hastings added the comment: Can you post the updated patch please? -- ___ Python tracker ___ ___

[issue26698] IDLE DPI Awareness

2016-04-06 Thread SilentGhost
Changes by SilentGhost : -- nosy: +gpolo, kbk, roger.serwy, serhiy.storchaka, terry.reedy ___ Python tracker ___

[issue26702] A better assert statement

2016-04-06 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Apr 06, 2016, at 03:07 PM, Serhiy Storchaka wrote: >I think in this particular case you are more interesting in the value of k >than k.replace('.', '').replace('-', '').replace('_', ''). Possibly so. -- ___

[issue26702] A better assert statement

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think in this particular case you are more interesting in the value of k than k.replace('.', '').replace('-', '').replace('_', ''). -- nosy: +rhettinger, serhiy.storchaka ___ Python tracker

[issue23551] IDLE to provide menu link to PIP gui.

2016-04-06 Thread Eric Khoo Jiun Hooi
Eric Khoo Jiun Hooi added the comment: I try to open the script in editor mode and run the script. It restart shell and run the script. I upload the picture of it, is there any wrong with it? -- Added file: http://bugs.python.org/file42378/tem_v3_idle.png

[issue26702] A better assert statement

2016-04-06 Thread Barry A. Warsaw
New submission from Barry A. Warsaw: Too many times I hit failing assert statements, and have no idea what value is causing the assertion to fail. Sure, you can provide a value to print (instead of just the failing code) but it seems to be fairly rarely used. And it can also lead to code

[issue26701] Documentation for int constructor mentions __int__ but not __trunc__

2016-04-06 Thread R. David Murray
R. David Murray added the comment: It is documented in the relevant PEP (pep 3141), but should indeed be added to the appropriate places in the regular documentation. -- nosy: +r.david.murray versions: +Python 3.6 ___ Python tracker

[issue26257] Eliminate buffer_tests.py

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nice. > I discovered a flaw in the bytearray tests: most of them don’t actually test > bytearray objects! Good catch! > I adapted the tests from the deleted buffer_tests.py file to override the > relevant tests from string_tests.py, so that we continue to

[issue26257] Eliminate buffer_tests.py

2016-04-06 Thread Martin Panter
Martin Panter added the comment: I discovered a flaw in the bytearray tests: most of them don’t actually test bytearray objects! This is easy to fix in Python 3, and I added a test case to ensure that the arguments are converted to the expected type. However porting this fix to Python 2 was

[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-06 Thread SilentGhost
Changes by SilentGhost : -- status: pending -> open ___ Python tracker ___ ___

[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-04-06 Thread SilentGhost
SilentGhost added the comment: I'm largely fine with it, bar the in-function import. It would also be good if you could verify that no other temporary files are left after the function is run. As I said earlier, issue 25544 should have priority and it should get a refreshed patch soon.

[issue26701] Documentation for int constructor mentions __int__ but not __trunc__

2016-04-06 Thread Robert Smallshire
New submission from Robert Smallshire: The documentation for the int(x) constructor explains that if possible, it delegates to x.__int__(). The documentation does not explain that there is a fallback to x.__trunc__() if x.__int__() is not available. The only mention of __trunc__ in the

[issue26700] Make digest_size a class variable

2016-04-06 Thread Raymond Hettinger
New submission from Raymond Hettinger: It would be nicer if this worked: >>> hashlib.md5.digest_size 64 -- assignee: gregory.p.smith components: Extension Modules messages: 262940 nosy: gregory.p.smith, rhettinger priority: normal severity: normal status: open title: Make

[issue26200] SETREF adds unnecessary work in some cases

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Py_SETREF was renamed to Py_XSETREF in 719c11b6b6ff, d0c8b2c1544e and 7197809a7428. Here is a patch that introduces new Py_SETREF and uses it instead Py_XSETREF if Py_DECREF was used before. -- keywords: +patch Added file:

[issue22570] Better stdlib support for Path objects

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, these changesets were related to issue26200. -- ___ Python tracker ___

[issue23551] IDLE to provide menu link to PIP gui.

2016-04-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: F5 from the editor, with a Shell window already present. -- ___ Python tracker ___

[issue26699] locale.str docstring is incorrect: "Convert float to integer"

2016-04-06 Thread Mark Dickinson
New submission from Mark Dickinson: [Observed by one of my colleagues] The locale.str docstring currently looks like this (and apparently has been this way since the dawn of time): def str(val): """Convert float to integer, taking the locale into account.""" The output of str

[issue22570] Better stdlib support for Path objects

2016-04-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset d0c8b2c1544e by Serhiy Storchaka in branch '3.5': Issue #22570: Renamed Py_SETREF to Py_XSETREF. https://hg.python.org/cpython/rev/d0c8b2c1544e New changeset 719c11b6b6ff by Serhiy Storchaka in branch 'default': Issue #22570: Renamed Py_SETREF to

[issue26200] SETREF adds unnecessary work in some cases

2016-04-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please apply the new macros so that all the original DECREFs are restored rather than blindly converted to XDECREFs. -- ___ Python tracker

[issue26200] SETREF adds unnecessary work in some cases

2016-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since several core devs agree that we should have doual macros, I'll rename Py_SETREF to Py_XSETREF and add new Py_SETREF. -- ___ Python tracker