From report at bugs.python.org Thu Sep 1 00:15:18 2016 From: report at bugs.python.org (John Mark Vandenberg) Date: Thu, 01 Sep 2016 04:15:18 +0000 Subject: [issue27924] ensurepip raises TypeError after pip uninstall In-Reply-To: <1472698976.68.0.784480763699.issue27924@psf.upfronthosting.co.za> Message-ID: <1472703318.43.0.21656800256.issue27924@psf.upfronthosting.co.za> John Mark Vandenberg added the comment: Well, it wasnt my intention to remove the vendor package. There were two versions, and I assume it would remove the older package which wasnt supplied by the vendor, but it removed both. Anyways, I see that most of the code path is in https://github.com/fedora-python/rewheel/blob/master/python2-ensurepip-rewheel.patch#L36 I guess there isnt much the cpython module can do here. ---------- resolution: -> third party status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 00:41:54 2016 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 01 Sep 2016 04:41:54 +0000 Subject: [issue27918] Running test suites without gui but still having windows flash In-Reply-To: <1472665002.34.0.0850471901825.issue27918@psf.upfronthosting.co.za> Message-ID: <1472704914.37.0.312147293789.issue27918@psf.upfronthosting.co.za> Xiang Zhang added the comment: It's my pleasure. > My point was that even when I request gui, I still don't want to see the flash. I also mean that in my last message, in this sentence " Even gui is enabled a single support.requires may seem somewhat confusing to flash a window". But it seems my poor English doesn't make it clear. :( issue27918.patch does the switch and I add the withdrawn you suggest. ---------- keywords: +patch Added file: http://bugs.python.org/file44314/issue27918.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 00:44:34 2016 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 01 Sep 2016 04:44:34 +0000 Subject: [issue25758] ensurepip/venv broken on Windows if path includes unicode In-Reply-To: <1448704613.06.0.448553989281.issue25758@psf.upfronthosting.co.za> Message-ID: <1472705074.06.0.946363541462.issue25758@psf.upfronthosting.co.za> Nick Coghlan added the comment: As a test case for handling non-ASCII characters in the name of the zipfile itself, I believe it should be sufficient to add '?' to TEMP_DIR and TEMP_ZIP in https://hg.python.org/cpython/file/default/Lib/test/test_zipimport.py ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 00:57:53 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Thu, 01 Sep 2016 04:57:53 +0000 Subject: [issue27630] Generator._encoded_EMTPY misspelling in email package In-Reply-To: <1469581633.21.0.276257861067.issue27630@psf.upfronthosting.co.za> Message-ID: <1472705873.35.0.421550386188.issue27630@psf.upfronthosting.co.za> Changes by Raymond Hettinger : ---------- assignee: -> r.david.murray _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 01:22:03 2016 From: report at bugs.python.org (Donald Stufft) Date: Thu, 01 Sep 2016 05:22:03 +0000 Subject: [issue27924] ensurepip raises TypeError after pip uninstall In-Reply-To: <1472698976.68.0.784480763699.issue27924@psf.upfronthosting.co.za> Message-ID: <1472707323.95.0.661802931723.issue27924@psf.upfronthosting.co.za> Donald Stufft added the comment: rewheel is definitely some Fedora patches. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 01:44:52 2016 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 01 Sep 2016 05:44:52 +0000 Subject: [issue27924] ensurepip raises TypeError after pip uninstall In-Reply-To: <1472698976.68.0.784480763699.issue27924@psf.upfronthosting.co.za> Message-ID: <1472708692.58.0.811240226499.issue27924@psf.upfronthosting.co.za> Nick Coghlan added the comment: Yeah, this is a known problem with pip where if you run it with sudo, it will happily uninstall system managed files from the system Python. To fix your system (if you haven't already): $ sudo dnf reinstall python2-pip (Anyone that accidentally uninstalls one of DNF's dependencies is in for a world of pain, but fortunately for this case pip doesn't fall into that category) For the actual "pip currently happily uninstalls distro packages when run with sudo" problem, https://mail.python.org/pipermail/distutils-sig/2016-January/028080.html is the most recent discussion of that situation. So we have a basic concept in place for how to make "sudo pip uninstall" less dangerous, it just requires coordination between PyPA updates to pip and downstream distro packaging policies to get us there. ---------- nosy: +encukou _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 01:47:33 2016 From: report at bugs.python.org (Elias Zamaria) Date: Thu, 01 Sep 2016 05:47:33 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472708853.93.0.349958930582.issue27923@psf.upfronthosting.co.za> Elias Zamaria added the comment: @martin.panter, I am familiar with Mercurial, and with the concept of rebasing, but I don't understand what you are trying to tell me. I made these changes in several local branches, and then merged them all together in one branch. How can I rebase it onto a public revision? Can I just do it, or do I need some sort of special privileges? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 03:04:32 2016 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 01 Sep 2016 07:04:32 +0000 Subject: [issue27918] Running test suites without gui but still having windows flash In-Reply-To: <1472665002.34.0.0850471901825.issue27918@psf.upfronthosting.co.za> Message-ID: <1472713472.3.0.37067764543.issue27918@psf.upfronthosting.co.za> Changes by Xiang Zhang : Removed file: http://bugs.python.org/file44314/issue27918.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 03:04:41 2016 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 01 Sep 2016 07:04:41 +0000 Subject: [issue27918] Running test suites without gui but still having windows flash In-Reply-To: <1472665002.34.0.0850471901825.issue27918@psf.upfronthosting.co.za> Message-ID: <1472713481.67.0.489114752049.issue27918@psf.upfronthosting.co.za> Changes by Xiang Zhang : Added file: http://bugs.python.org/file44315/issue27918.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 03:07:45 2016 From: report at bugs.python.org (Martin Panter) Date: Thu, 01 Sep 2016 07:07:45 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472713665.13.0.587800405103.issue27923@psf.upfronthosting.co.za> Martin Panter added the comment: Here is what I did. (You could probably do this yourself, but never mind :) hg pull -r{default,2.7,3.5} hg update default # Update to the latest public revision hg import --no-commit "$(xclip -o)" # Apply your patch on top hg diff -p > pep467.patch # Make a new diff If you look inside the patch file, the difference is that the Reitveld review system cannot handle ?diff -r 3e41c0449b9c? from your file, but hopefully will know about ?diff -r ebb23744a36c? in my version. ---------- Added file: http://bugs.python.org/file44316/pep467.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 03:08:34 2016 From: report at bugs.python.org (Martin Panter) Date: Thu, 01 Sep 2016 07:08:34 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472713714.41.0.142019006133.issue27923@psf.upfronthosting.co.za> Changes by Martin Panter : Added file: http://bugs.python.org/file44317/pep467_doc_changes.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 04:02:29 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 08:02:29 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <1472716949.85.0.0136699608437.issue27881@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: > Xiang what do you think about changing the isolation_levels list to begin_statements list This is interesting suggestion. Indeed, this simplifies the code. Thanks Aviv. ---------- Added file: http://bugs.python.org/file44318/issue27881_v4.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 04:13:32 2016 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 01 Sep 2016 08:13:32 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <1472717612.06.0.964625413365.issue27881@psf.upfronthosting.co.za> Xiang Zhang added the comment: Hmm, you do this "It's going to be freed in the dealloc method unless your alter that part too". If this is done I admit this is more clean. Patch LGTM. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 04:31:48 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Thu, 01 Sep 2016 08:31:48 +0000 Subject: [issue27925] Nicer interface to convert hashlib digests to int Message-ID: <1472718708.44.0.588974083433.issue27925@psf.upfronthosting.co.za> New submission from Steven D'Aprano: hashlib digests should have a nicer interface to allow conversion to ints. Currently we write int(x.hexdigest(), 16) which is less than obvious and easy to get wrong. It would be nice to be able to just say int(x) (that's my strong preference) or x.as_int(). Use-case: sometimes we need to store hashes in a database table which, for historical reasons, is an integer. ---------- messages: 274102 nosy: steven.daprano priority: normal severity: normal status: open title: Nicer interface to convert hashlib digests to int type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 04:47:14 2016 From: report at bugs.python.org (Michael Foord) Date: Thu, 01 Sep 2016 08:47:14 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472719634.98.0.0720770205585.issue27376@psf.upfronthosting.co.za> Changes by Michael Foord : ---------- assignee: -> michael.foord _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 04:51:43 2016 From: report at bugs.python.org (Michael Foord) Date: Thu, 01 Sep 2016 08:51:43 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472719903.1.0.520157732622.issue27376@psf.upfronthosting.co.za> Michael Foord added the comment: Is this for mocking out runtime dependencies that aren't available at test time? It seems like a good way of masking bugs! I'd be happier with a (or at least an option) to specify the imports that should be mocked. The use case should be mentioned in the docs. I think the name is slightly confusing. I originally thought this was a function to mock specific imports - not to catch failed imports. mock_missing_import (or similar) would be a better name. It's common with the mock functions to be able to provide a class to use as the mock function, and to take arbitrary keyword arguments to pass to the mock constructor. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:02:07 2016 From: report at bugs.python.org (Eyal Posener) Date: Thu, 01 Sep 2016 09:02:07 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472720527.57.0.916923299323.issue27376@psf.upfronthosting.co.za> Eyal Posener added the comment: Thanks for the review, Michael. About the use case: I use it for a process with loads code and inspect it's classes and methods. When I run this process, not always I have all the dependencies of the inspected code, so I found myself mocking all those packages before running the inspection code. This was very inconvenience, and broke any time someone added a new dependency to the code which is not in the standard library. About the name: I agree. About the keyword for the mock constructor: no problems. Should I fix the code and submit an updated patch? Do you think this function has a place in the standard mock module? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:04:03 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 09:04:03 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <1472720643.37.0.144755923831.issue23591@psf.upfronthosting.co.za> STINNER Victor added the comment: As noticed by veky on the review, _high_bit() is slow and can be optimized using int.bit_length(). Attached bit_length.patch implements this. _high_bit(0) returns -1. Maybe an exception must be raised if the argument is < 1? (also fail for negative number) ---------- Added file: http://bugs.python.org/file44319/bit_length.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:08:34 2016 From: report at bugs.python.org (Michael Foord) Date: Thu, 01 Sep 2016 09:08:34 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472720914.62.0.727375599552.issue27376@psf.upfronthosting.co.za> Michael Foord added the comment: It's not a use case I've specifically had but I can see its use. I'm uncertain of whether that means it belongs in the module or not. Let me see if I can get some more eyes on this bug. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:09:16 2016 From: report at bugs.python.org (=?utf-8?b?VmVkcmFuIMSMYcSNacSH?=) Date: Thu, 01 Sep 2016 09:09:16 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <1472720956.56.0.000460674885263.issue23591@psf.upfronthosting.co.za> Vedran ?a?i? added the comment: Sure, errors should never pass silently. This function shouldn't be called with nonpositive arguments. And there is no highbit of 0 (and there are infinitely many of negative numbers;). ValueError is probably best - though IndexError can also be argued for, since this is quite analogous to pop from empty list. :-) ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:19:10 2016 From: report at bugs.python.org (Michael Foord) Date: Thu, 01 Sep 2016 09:19:10 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472721550.64.0.594926741706.issue27376@psf.upfronthosting.co.za> Michael Foord added the comment: Before you spend any more time on this, my current thinking is that this is a bit too specialised to belong in the standard library. I'll wait and see if a preponderance of core devs and other users disagree with me before I close this though. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:20:00 2016 From: report at bugs.python.org (Martin Panter) Date: Thu, 01 Sep 2016 09:20:00 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472721600.65.0.98479188386.issue27923@psf.upfronthosting.co.za> Martin Panter added the comment: Thanks for the patches. I left you some comments in the code review. I expect there would be more bits of the docs that need fixing. Doc/library/functions.rst definitely; the tutorial is worth checking too. There may also be example code floating around using the deprecated calls. Regarding code that uses the deprecated call, as well as blind searching (grep), you could try running the entire test suite with -Werror. That should catch a lot of them. In the RST documentation, I think you missed adding entries for the zeros() and byte() constructor methods. Maybe use the other class methods maketrans(), fromhex() as a starting point. Also, this will need an entry written for Doc/whatsnew/3.6.rst. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:28:34 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 09:28:34 +0000 Subject: [issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0 In-Reply-To: <1456920893.87.0.933592382559.issue26470@psf.upfronthosting.co.za> Message-ID: <1472722114.26.0.511623998156.issue26470@psf.upfronthosting.co.za> Antoine Pitrou added the comment: Christian, thanks a lot for doing this! Do you plan to change the SSLContext constructor and make the protocol argument optional? It sounds like that would be a logical followup to the OpenSSL API changes. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:31:15 2016 From: report at bugs.python.org (Tom Cornebize) Date: Thu, 01 Sep 2016 09:31:15 +0000 Subject: [issue27926] ctypes is too slow to convert a Python list to a C array Message-ID: <1472722275.26.0.560476389343.issue27926@psf.upfronthosting.co.za> New submission from Tom Cornebize: It is much faster to construct a Python array from the list and then cast this array, rather than using the "standard" constructor. See attached file to compare the performances. This issue was previously asked on Stackoverflow: http://stackoverflow.com/questions/39225263/why-is-ctypes-so-slow-to-convert-a-python-list-to-a-c-array/ ---------- components: ctypes files: ctypes_slow.py messages: 274111 nosy: Tom Cornebize priority: normal severity: normal status: open title: ctypes is too slow to convert a Python list to a C array type: performance Added file: http://bugs.python.org/file44320/ctypes_slow.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:31:56 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 09:31:56 +0000 Subject: [issue27691] X509 cert with GEN_RID subject alt name causes SytemError In-Reply-To: <1470389195.49.0.571813101842.issue27691@psf.upfronthosting.co.za> Message-ID: <1472722316.21.0.409496018033.issue27691@psf.upfronthosting.co.za> Antoine Pitrou added the comment: I can't comment on this, as I don't even know what a "registered id" is, sorry :-/ ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 05:33:46 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 09:33:46 +0000 Subject: [issue27866] ssl: get list of enabled ciphers In-Reply-To: <1472210954.34.0.734962882785.issue27866@psf.upfronthosting.co.za> Message-ID: <1472722426.57.0.160899288643.issue27866@psf.upfronthosting.co.za> Antoine Pitrou added the comment: What does "kea" mean? Key exchange? ---------- nosy: +pitrou _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 06:06:59 2016 From: report at bugs.python.org (Benjamin Giesers) Date: Thu, 01 Sep 2016 10:06:59 +0000 Subject: [issue27927] argparse: default propagation of formatter_class from ArgumentParser() to SubParsers Message-ID: <1472724419.75.0.20824788392.issue27927@psf.upfronthosting.co.za> New submission from Benjamin Giesers: It would be nice to propagate the formatter_class defined in argparse.ArgumentParser() to added SubParsers by default. Currently one has to define the formatter_class for each subparser again and again. Example: parser = argparse.ArgumentParser(description='property', formatter_class=argparse.ArgumentDefaultsHelpFormatter) subparsers = parser.add_subparsers(help='sub-command help') pcar = subparsers.add_parser('car', help='add car', formatter_class=argparse.ArgumentDefaultsHelpFormatter) pcar.add_argument('--color', help='color of car', default='red') pyacht = subparsers.add_parser('yacht', help='add yacht', formatter_class=argparse.ArgumentDefaultsHelpFormatter) pyacht.add_argument('--length', help='length of yacht [m]', default=12.5) ---------- components: Library (Lib) messages: 274114 nosy: Benjamin Giesers priority: normal severity: normal status: open title: argparse: default propagation of formatter_class from ArgumentParser() to SubParsers type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 06:21:35 2016 From: report at bugs.python.org (Christian Heimes) Date: Thu, 01 Sep 2016 10:21:35 +0000 Subject: [issue27866] ssl: get list of enabled ciphers In-Reply-To: <1472210954.34.0.734962882785.issue27866@psf.upfronthosting.co.za> Message-ID: <1472725295.74.0.487644983475.issue27866@psf.upfronthosting.co.za> Christian Heimes added the comment: KEA stands for key exchange algorithm. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 06:32:13 2016 From: report at bugs.python.org (Christian Heimes) Date: Thu, 01 Sep 2016 10:32:13 +0000 Subject: [issue27691] X509 cert with GEN_RID subject alt name causes SytemError In-Reply-To: <1470389195.49.0.571813101842.issue27691@psf.upfronthosting.co.za> Message-ID: <1472725933.13.0.277192504527.issue27691@psf.upfronthosting.co.za> Christian Heimes added the comment: A GEN_RID is an OID plus some opaque data. It's up to an application to understand an OID and interpret its data. The value of a GEN_RID can be as simple as an int or UTF-8 strings or as complex as a nested ASN.1 struct for Kerberos principals. I have modified Lib/test/make_ssl_certs.py to include two GEN_RIDS: otherName.1 = 1.2.3.4;UTF8:some other identifier otherName.2 = 1.3.6.1.5.2.2;SEQUENCE:princ_name [princ_name] realm = EXP:0, GeneralString:KERBEROS.REALM principal_name = EXP:1, SEQUENCE:principal_seq [principal_seq] name_type = EXP:0, INTEGER:1 name_string = EXP:1, SEQUENCE:principals [principals] princ1 = GeneralString:username 1.3.6.1.5.2.2 is the OID for Kerberos public key init (pkinit), used for e.g. FAST pre-auth and SmartCard authentication. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 06:32:55 2016 From: report at bugs.python.org (Barry A. Warsaw) Date: Thu, 01 Sep 2016 10:32:55 +0000 Subject: [issue27921] f-strings: do not allow backslashes In-Reply-To: <1472687380.69.0.18258745604.issue27921@psf.upfronthosting.co.za> Message-ID: <1472725975.76.0.460160619736.issue27921@psf.upfronthosting.co.za> Changes by Barry A. Warsaw : ---------- nosy: +barry _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 06:50:06 2016 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 01 Sep 2016 10:50:06 +0000 Subject: [issue27919] Deprecate and remove extra_path distribution kwarg In-Reply-To: <1472670374.61.0.857588658064.issue27919@psf.upfronthosting.co.za> Message-ID: <1472727006.11.0.441744359298.issue27919@psf.upfronthosting.co.za> Nick Coghlan added the comment: I think there are two time frames to look at here: 1. How do we make it easier for folks to work with existing packages like the newrelic one? For that, it may make sense for at least setuptools to override extra_path when using installation targets other then sysconfig.get_path("purelib") and sysconfig.get_path("platlib") such that they get the same result as if "extra_path" wasn't there. We know the setting isn't going to work, so ignoring it actually seems like it may be the more user friendly option. 2. How do we persuade publishers to stop using the "extra_path" feature in the first place? I'm less sure of the benefits of that step, as I'm not sure why anyone would choose to use extra_path in the first place - the common "*.pth" file means you can still get conflicts, even with a versioned path name, and if you keep the dist-into directory, --single-version-externally-managed already gives you version info directly in the filesystem. The use case does seem obscure enough that we could deprecate it as an undocumented feature that is incompatible with non-site-packages installs, and then see if anyone objects to the deprecation. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 08:29:19 2016 From: report at bugs.python.org (Christian Heimes) Date: Thu, 01 Sep 2016 12:29:19 +0000 Subject: [issue27928] Add hashlib.scrypt Message-ID: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> New submission from Christian Heimes: OpenSSL 1.1 has EVP_PBE_scrypt(). hashlib.scrypt() is a low-hanging fruit for Python 3.6. I have a working patch with some tests. I need to write more tests and documentation: https://github.com/tiran/cpython/commits/feature/openssl110_scrypt ---------- messages: 274118 nosy: christian.heimes, gregory.p.smith priority: normal severity: normal stage: patch review status: open title: Add hashlib.scrypt type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 08:41:46 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 01 Sep 2016 12:41:46 +0000 Subject: [issue27364] Deprecate invalid unicode escape sequences In-Reply-To: <1466541260.02.0.320668077341.issue27364@psf.upfronthosting.co.za> Message-ID: <1472733706.51.0.181906308056.issue27364@psf.upfronthosting.co.za> Emanuel Barry added the comment: Ping. I'd like to get this merged in time for 3.6. Is there anything I can do to speed up the review? Since the change itself is very straightforward, I think this would make sense to merge it now and then fix the invalid escapes that are found during the beta phase. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:01:26 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 13:01:26 +0000 Subject: [issue27364] Deprecate invalid unicode escape sequences In-Reply-To: <1466541260.02.0.320668077341.issue27364@psf.upfronthosting.co.za> Message-ID: <1472734886.43.0.491892586539.issue27364@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: I think "invalid escape sequence '\?'" would look cleaner than "invalid escape sequence '?'". ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:11:30 2016 From: report at bugs.python.org (kevinconway) Date: Thu, 01 Sep 2016 13:11:30 +0000 Subject: [issue27906] Socket accept exhaustion during high TCP traffic In-Reply-To: <1472608644.33.0.983787454696.issue27906@psf.upfronthosting.co.za> Message-ID: <1472735490.46.0.233569434642.issue27906@psf.upfronthosting.co.za> kevinconway added the comment: Added a comment to the .accept() loop with a reference to the issue. ---------- Added file: http://bugs.python.org/file44321/multi-accept-3.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:12:27 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:12:27 +0000 Subject: [issue27809] Add _PyFunction_FastCallDict(): fast call with keyword arguments as a dict In-Reply-To: <1471652485.87.0.888349728997.issue27809@psf.upfronthosting.co.za> Message-ID: <1472735547.15.0.347824577762.issue27809@psf.upfronthosting.co.za> STINNER Victor added the comment: The main feature has been merged, so I close the issue. ---------- resolution: -> fixed status: open -> closed title: _PyObject_FastCall(): add support for keyword arguments -> Add _PyFunction_FastCallDict(): fast call with keyword arguments as a dict _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:13:54 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:13:54 +0000 Subject: [issue27128] Add _PyObject_FastCall() In-Reply-To: <1464257756.81.0.101125062969.issue27128@psf.upfronthosting.co.za> Message-ID: <1472735634.1.0.124996547691.issue27128@psf.upfronthosting.co.za> STINNER Victor added the comment: The main features (_PyFunction_FastCall()) has been merged. Supporting keyword arguments is now handled by other issue (see issue #27830). I close this issue. ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:15:25 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:15:25 +0000 Subject: [issue26814] [WIP] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments In-Reply-To: <1461229041.59.0.994194592206.issue26814@psf.upfronthosting.co.za> Message-ID: <1472735725.82.0.603796895747.issue26814@psf.upfronthosting.co.za> STINNER Victor added the comment: I splitted the giant patch into smaller patches easier to review. The first part (_PyObject_FastCall, _PyObject_FastCallDict) is already merged. Other issues were opened to implement the full feature. I now close this issue. ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:16:18 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:16:18 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472735778.67.0.23586208108.issue26530@psf.upfronthosting.co.za> STINNER Victor added the comment: @Nathaniel, Antoine: last ping before timeout :-p ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:19:49 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 01 Sep 2016 13:19:49 +0000 Subject: [issue27364] Deprecate invalid unicode escape sequences In-Reply-To: <1466541260.02.0.320668077341.issue27364@psf.upfronthosting.co.za> Message-ID: <1472735989.33.0.994722476915.issue27364@psf.upfronthosting.co.za> Emanuel Barry added the comment: Thanks Serhiy; it does look better to me too! ---------- Added file: http://bugs.python.org/file44322/deprecate_invalid_escapes_both_3.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:22:56 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 13:22:56 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472736176.22.0.0503766686557.issue26530@psf.upfronthosting.co.za> Antoine Pitrou added the comment: Is the timeout part of the API? :-) ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:24:46 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:24:46 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472736286.15.0.492760115725.issue26530@psf.upfronthosting.co.za> STINNER Victor added the comment: > Is the timeout part of the API? :-) I don't want to make the API public before you validated that it is usable for your use case or to track numpy memory usage. I guess that the first beta release of Python 3.6 is the deadline for this issue. Otherwise, we will have to wait ~2 years with Python 3.7. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:31:29 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 13:31:29 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472736689.21.0.657141991967.issue26530@psf.upfronthosting.co.za> Antoine Pitrou added the comment: I may be a bit confused, but the "domain" integer you added in issue 26588 doesn't seem to be part of this API... Is it deliberate? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:56:25 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 13:56:25 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472738185.22.0.180461074045.issue26530@psf.upfronthosting.co.za> STINNER Victor added the comment: > I may be a bit confused, but the "domain" integer you added in issue 26588 doesn't seem to be part of this API... Is it deliberate? They are part of this API. msg262180: """Ok, I added the following C functions: int _PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, size_t size); int _PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr); (...)""" The domain 0 is used to track Python memory allocations. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 09:59:55 2016 From: report at bugs.python.org (Robert Jordens) Date: Thu, 01 Sep 2016 13:59:55 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH Message-ID: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> New submission from Robert Jordens: Since 3.5.2 sock_connect() tries to be smart and resolves addresses for you if they fail a socket.inet_pton() check. But inet_pton() only supports AF_INET(6) and does not work for other address families that socket otherwise supports just fine (e.g. AF_BLUETOOTH). Before 3.5.2, in order to happily use bluetooth sockets with asyncio, you could just do: sock = socket.socket(family=socket.AF_BLUETOOTH, type=socket.SOCK_STREAM, proto=socket.BTPROTO_RFCOMM) sock.setblocking(False) addr = "00:12:34:56:78:99" yield from loop.sock_connect(sock, (addr, 1)) This is a regression. ---------- components: Argument Clinic messages: 274131 nosy: Robert.Jordens, larry priority: normal severity: normal status: open title: asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:01:55 2016 From: report at bugs.python.org (Robert Jordens) Date: Thu, 01 Sep 2016 14:01:55 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH In-Reply-To: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> Message-ID: <1472738515.03.0.408328542085.issue27929@psf.upfronthosting.co.za> Robert Jordens added the comment: The error for inet_pton() is: >>> import socket >>> socket.inet_pton(socket.AF_BLUETOOTH, "00:12:34:56:78:99") Traceback (most recent call last): File "", line 1, in socket.error: [Errno 97] Address family not supported by protocol And the traceback in asyncio is: DEBUG:asyncio:Using selector: EpollSelector Traceback (most recent call last): File "log.py", line 91, in main() File "log.py", line 84, in main loop.run_until_complete(log(loop, sys.argv[1])) File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete return future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step result = coro.throw(exc) File "log.py", line 22, in log yield from loop.sock_connect(sock, (addr, 1)) File "/usr/lib/python3.5/asyncio/selector_events.py", line 397, in sock_connect yield from resolved File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.5/socket.py", line 732, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -5] No address associated with hostname ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:03:01 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 14:03:01 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472738581.46.0.466932596819.issue26530@psf.upfronthosting.co.za> Antoine Pitrou added the comment: Which patch are we talking about? In tracemalloc_track-3.patch, I see: + If memory block is already tracked, update the existing trace. */ +PyAPI_FUNC(int) _PyTraceMalloc_Track(void *ptr, size_t size); + +/* Untrack an allocated memory block in the tracemalloc module. + Do nothing if the block was not tracked. + + Do nothing if tracemalloc is not tracing Python memory allocations. */ +PyAPI_FUNC(void) _PyTraceMalloc_Untrack(void *ptr); ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:11:59 2016 From: report at bugs.python.org (Robert Jordens) Date: Thu, 01 Sep 2016 14:11:59 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH In-Reply-To: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> Message-ID: <1472739119.24.0.4050881086.issue27929@psf.upfronthosting.co.za> Changes by Robert Jordens : ---------- components: +asyncio -Argument Clinic nosy: +gvanrossum, haypo, yselivanov _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:15:16 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 01 Sep 2016 14:15:16 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH In-Reply-To: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> Message-ID: <1472739316.07.0.39649556635.issue27929@psf.upfronthosting.co.za> Emanuel Barry added the comment: Thanks for the report! I'm unable to reproduce, as `socket.AF_BLUETOOTH` doesn't exist on my system, but surely someone else can. ---------- keywords: +3.5regression nosy: +ebarry, ned.deily priority: normal -> high stage: -> needs patch title: asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH -> asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH type: -> behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:38:40 2016 From: report at bugs.python.org (Stefan Behnel) Date: Thu, 01 Sep 2016 14:38:40 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472740720.47.0.936968775012.issue22458@psf.upfronthosting.co.za> Stefan Behnel added the comment: Done: https://github.com/python/performance/pull/10 Note that I didn't replace the existing telco benchmark as it is more specific to Decimal. The new benchmark makes it possible to compare the decimal and fractions modules for similar operations, though. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:46:56 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 14:46:56 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472741216.38.0.0388976082642.issue26530@psf.upfronthosting.co.za> STINNER Victor added the comment: > Which patch are we talking about? I'm talking about this change which was already merged into the default branch of Python in March 2016: New changeset 60655e543d8a by Victor Stinner in branch 'default': Add C functions _PyTraceMalloc_Track() https://hg.python.org/cpython/rev/60655e543d8a ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:49:22 2016 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 01 Sep 2016 14:49:22 +0000 Subject: [issue26530] tracemalloc: add C API to manually track/untrack memory allocations In-Reply-To: <1457619430.68.0.0968942184372.issue26530@psf.upfronthosting.co.za> Message-ID: <1472741362.98.0.482443389422.issue26530@psf.upfronthosting.co.za> Antoine Pitrou added the comment: Uh... ok, I thought you wanted some feedback on the patches posted, since I didn't know you had committed a new version of them. I haven't tried to use the new API (for various reasons it's a bit cumbersome to use a self-compiled Python for Numba), but I'm sure it will be good enough. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:53:44 2016 From: report at bugs.python.org (Eryk Sun) Date: Thu, 01 Sep 2016 14:53:44 +0000 Subject: [issue27926] ctypes is too slow to convert a Python list to a C array In-Reply-To: <1472722275.26.0.560476389343.issue27926@psf.upfronthosting.co.za> Message-ID: <1472741624.26.0.761485106454.issue27926@psf.upfronthosting.co.za> Eryk Sun added the comment: This is a consequence of several factors. It starts with the __init__ method of ctypes.Array, Array_init. This function doesn't hard-code calling the base sq_ass_item slot function, Array_ass_item. If it did, it wouldn't be nearly as slow. Instead it calls the abstract function PySequence_SetItem. Doing it this way accommodates an array subclass that overrides __setitem__. What I'd like to do here is check whether the sq_ass_item slot is defined as Array_ass_item, and if so call it directly instead of PySequence_SetItem. But it turns out that it's not set as Array_ass_item even if the subclass doesn't override __setitem__, and more than anything this is the real culprit for the relative slowness of Array_init. If a built-in type such as ctypes.Array defines both mp_ass_subscript and sq_ass_item, then the __setitem__ wrapper_descriptor wraps the more generic mp_ass_subscript slot function. Then for a subclass, update_one_slot in Objects/typeobject.c plays it safe when updating the sq_ass_item slot. It sees that the inherited __setitem__ descriptor doesn't call wrap_sq_setitem, so it defines the slot in the subclass to use the generic function slot_sq_ass_item. This generic slot function goes the long way around to look up and bind the __setitem__ method and convert the Py_ssize_t index to a Python integer, to call the wrapper that calls the mp_ass_subscript slot. To add insult to injury, the implementation of this slot for a ctypes Array, Array_ass_subscript, has to convert back to a Py_ssize_t integer via PyNumber_AsSsize_t. I don't know if this can be resolved while preserving the generic design of the initializer. As is, calling PySequence_SetItem in a tight loop is ridiculously slow. I experimented with calling Array_ass_item directly. With this change it's as fast as assigning to a slice of the whole array. Actually with a list it's a bit slower because *t has to be copied to a tuple. But it takes about the same amount of time as assigning to a slice when t is already a tuple, such as tuple(range(1000000)). I doubt any amount of tweaking will make ctypes as fast as an array.array. ctypes has a generic design to accommodate simple C data, pointers, and aggregate arrays, structs, and unions. This comes with some cost to performance. However, you can and should make use of the buffer protocol to use arrays from the array module or numpy where performance is critical. It's trivial to create a ctypes array from an object that supports the buffer protocol. For example: v = array.array('I', t) a = (ctypes.c_uint32 * len(v)).from_buffer(v) There's no need to use the array.array's buffer_info() or ctypes.cast(). The from_buffer() method creates an array that shares the buffer of the source object, so it's relatively fast. It's also returning a sized array instead of a lengthless pointer (though it is possible to cast to an array pointer and immediately dereference the array). ---------- nosy: +eryksun _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 10:54:15 2016 From: report at bugs.python.org (Eryk Sun) Date: Thu, 01 Sep 2016 14:54:15 +0000 Subject: [issue27926] ctypes is too slow to convert a Python list to a C array In-Reply-To: <1472722275.26.0.560476389343.issue27926@psf.upfronthosting.co.za> Message-ID: <1472741655.72.0.616654178255.issue27926@psf.upfronthosting.co.za> Changes by Eryk Sun : ---------- versions: +Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:15:59 2016 From: report at bugs.python.org (Petr Viktorin) Date: Thu, 01 Sep 2016 15:15:59 +0000 Subject: [issue27930] logging's QueueListener drops log messages Message-ID: <1472742959.65.0.510011909854.issue27930@psf.upfronthosting.co.za> New submission from Petr Viktorin: There are two "barrier" like abstractions on Lib/logging/handlers.py in the _monitor method. First _monitor has two loops, what is already kind of a hint something is not right. Second, it has two ways to exit the loop, that also exit the thread: 1) The _stop threading.Event is "set" 2) The _sentinel object is added to the queue The problem is, the documentation says that the correct way to not loose records, the stop method must be called, but, the stop method just sets the _stop object and then adds the _sentinel object to the queue. The loop stops when noticing that _stop is set, and then enters a second version of the loop, trying again to see the _sentinel object, but this time with non blocking read. The test case shows the problem, but it also hints about the race conditions by the fact that running the test case under "taskset 1" works, so, to reproduce the issue, run the test under a multiprocessor environment. The proper solution would be to have a proper locking mechanism, otherwise, the _stop object should not be used, and rely only in seeing the _sentinel field; this is what the class DeterministicQueueListener does in the test case. (Reported by Paulo Andrade at https://bugzilla.redhat.com/show_bug.cgi?id=1370484 ) ---------- components: Library (Lib) files: test.py messages: 274139 nosy: encukou, vinay.sajip priority: normal severity: normal status: open title: logging's QueueListener drops log messages versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file44323/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:29:39 2016 From: report at bugs.python.org (=?utf-8?b?0JrQvtC90YHRgtCw0L3RgtC40L0g0JLQvtC70LrQvtCy?=) Date: Thu, 01 Sep 2016 15:29:39 +0000 Subject: [issue27931] Email parse IndexError <""@wiarcom.com> Message-ID: <1472743779.07.0.918992764498.issue27931@psf.upfronthosting.co.za> New submission from ?????????? ??????: Email lib fails to parse some emails: from email._header_value_parser import get_angle_addr get_angle_addr('<""@wiarcom.com> SIZE=28113').addr_spec IndexError: list index out of range Seems that email address can be parsed. ---------- components: email messages: 274140 nosy: barry, r.david.murray, ?????????? ?????? priority: normal severity: normal status: open title: Email parse IndexError <""@wiarcom.com> versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:32:10 2016 From: report at bugs.python.org (R. David Murray) Date: Thu, 01 Sep 2016 15:32:10 +0000 Subject: [issue27925] Nicer interface to convert hashlib digests to int In-Reply-To: <1472718708.44.0.588974083433.issue27925@psf.upfronthosting.co.za> Message-ID: <1472743930.68.0.036138329819.issue27925@psf.upfronthosting.co.za> R. David Murray added the comment: +1 I just wanted this recently. Also note that going through hexdigest/int isn't particularly efficient, so an object-supported fast way to do this would be nice. ---------- nosy: +r.david.murray stage: -> needs patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:32:13 2016 From: report at bugs.python.org (Guido van Rossum) Date: Thu, 01 Sep 2016 15:32:13 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH In-Reply-To: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> Message-ID: <1472743933.15.0.069487040258.issue27929@psf.upfronthosting.co.za> Guido van Rossum added the comment: Looks related (possibly a duplicate) of issue #27136. Also related is a fix for the latter in https://github.com/python/asyncio/pull/357. That fix is already in the CPython repo, but I guess it didn't make it into 3.5.2. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:33:41 2016 From: report at bugs.python.org (Guido van Rossum) Date: Thu, 01 Sep 2016 15:33:41 +0000 Subject: [issue27906] Socket accept exhaustion during high TCP traffic In-Reply-To: <1472735490.46.0.233569434642.issue27906@psf.upfronthosting.co.za> Message-ID: Guido van Rossum added the comment: I'll try to get to this during the core dev sprint next week. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:34:33 2016 From: report at bugs.python.org (Okko Willeboordse) Date: Thu, 01 Sep 2016 15:34:33 +0000 Subject: [issue27932] platform.win32_ver() leaks in 2.7.12 Message-ID: <1472744071.14.0.482080718706.issue27932@psf.upfronthosting.co.za> New submission from Okko Willeboordse: Running; Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32 platform.win32_ver() returns; ('10', '10.0.10586', '', u'Multiprocessor Free') ---------- components: Windows files: leaked_objects.txt messages: 274144 nosy: Okko.Willeboordse, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: platform.win32_ver() leaks in 2.7.12 type: resource usage versions: Python 2.7 Added file: http://bugs.python.org/file44324/leaked_objects.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:35:39 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 15:35:39 +0000 Subject: [issue27932] platform.win32_ver() leaks in 2.7.12 In-Reply-To: <1472744071.14.0.482080718706.issue27932@psf.upfronthosting.co.za> Message-ID: <1472744139.76.0.0236775285785.issue27932@psf.upfronthosting.co.za> STINNER Victor added the comment: Hum, can you please elaborate the issue? What is leaked_objects.txt? ---------- nosy: +haypo _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:38:35 2016 From: report at bugs.python.org (Okko Willeboordse) Date: Thu, 01 Sep 2016 15:38:35 +0000 Subject: [issue27932] platform.win32_ver() leaks in 2.7.12 In-Reply-To: <1472744139.76.0.0236775285785.issue27932@psf.upfronthosting.co.za> Message-ID: Okko Willeboordse added the comment: I did a gc.get_objects() before and after platform.win32_ver() and printed objects that were not present before calling platform.win32_ver(). If I run platform.win32_ver() in a loop I see the memory increasing. On 1 September 2016 at 17:35, STINNER Victor wrote: > > STINNER Victor added the comment: > > Hum, can you please elaborate the issue? What is leaked_objects.txt? > > ---------- > nosy: +haypo > > _______________________________________ > Python tracker > > _______________________________________ > ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:41:03 2016 From: report at bugs.python.org (R. David Murray) Date: Thu, 01 Sep 2016 15:41:03 +0000 Subject: [issue27931] Email parse IndexError <""@wiarcom.com> In-Reply-To: <1472743779.07.0.918992764498.issue27931@psf.upfronthosting.co.za> Message-ID: <1472744463.98.0.336130911285.issue27931@psf.upfronthosting.co.za> Changes by R. David Murray : ---------- stage: -> needs patch versions: +Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:50:56 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Thu, 01 Sep 2016 15:50:56 +0000 Subject: [issue27925] Nicer interface to convert hashlib digests to int In-Reply-To: <1472718708.44.0.588974083433.issue27925@psf.upfronthosting.co.za> Message-ID: <1472745056.16.0.0710311812696.issue27925@psf.upfronthosting.co.za> Raymond Hettinger added the comment: "int(x)" looks nice to me as well. ---------- nosy: +rhettinger _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 11:57:58 2016 From: report at bugs.python.org (Tom Cornebize) Date: Thu, 01 Sep 2016 15:57:58 +0000 Subject: [issue27926] ctypes is too slow to convert a Python list to a C array In-Reply-To: <1472722275.26.0.560476389343.issue27926@psf.upfronthosting.co.za> Message-ID: <1472745478.01.0.259611267123.issue27926@psf.upfronthosting.co.za> Tom Cornebize added the comment: Thank you for these explanations. I understand that we get a generic function to the cost of performances. However, I think we should at least tell in the documentation that the constructor (ctypes.c_uint32 * len(t))(*t) is slow and that we can do much faster in some specific cases (e.g. an array of integers). It would be even better to have some specific method(s) to do this in ctypes, instead of having to rely on an array.array just to build a ctypes array from a list. I am not familiar with CPython code, so I do not know if it would be easily feasible. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:08:44 2016 From: report at bugs.python.org (=?utf-8?b?0KTQtdC00L7RgCDQm9GP0L3Qs9GD0LfQvtCy?=) Date: Thu, 01 Sep 2016 16:08:44 +0000 Subject: [issue27933] functools.lru_cache seems to not work when renaming decorated functions Message-ID: <1472746124.57.0.326377422927.issue27933@psf.upfronthosting.co.za> New submission from ????? ????????: Greetings, I've encountered strange behavior when using functools.lru_cache as a function (not as a decorator): it is at least miscounting misses, but probably not work at all, when the result of functools.lru_cache()(func) is saved in variable other than 'func'. Consider this snippet: def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) f = functools.lru_cache()(factorial) f(20) print(f.cache_info()) Output should be: CacheInfo(hits=0, misses=21, maxsize=128, currsize=21) Instead it is: CacheInfo(hits=0, misses=1, maxsize=128, currsize=1) I'm using Python 3.5.2 64bit on Windows 7 Professional 64bit. I've written 3 unittests (using built-in module), which are attached as a file. I don't know how to comment them (conceptually, not syntactically), sorry. Fedor ---------- components: Library (Lib) files: lru_cache_test.py messages: 274149 nosy: ????? ???????? priority: normal severity: normal status: open title: functools.lru_cache seems to not work when renaming decorated functions type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file44325/lru_cache_test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:18:21 2016 From: report at bugs.python.org (Christian Heimes) Date: Thu, 01 Sep 2016 16:18:21 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472746701.05.0.740323211404.issue27928@psf.upfronthosting.co.za> Changes by Christian Heimes : ---------- keywords: +patch Added file: http://bugs.python.org/file44326/Add-hashlib.scrypt.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:25:32 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 01 Sep 2016 16:25:32 +0000 Subject: [issue27933] functools.lru_cache seems to not work when renaming decorated functions In-Reply-To: <1472746124.57.0.326377422927.issue27933@psf.upfronthosting.co.za> Message-ID: <1472747132.32.0.61269700848.issue27933@psf.upfronthosting.co.za> Changes by Emanuel Barry : ---------- nosy: +ncoghlan, rhettinger _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:26:19 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Thu, 01 Sep 2016 16:26:19 +0000 Subject: [issue27268] Incorrect error message on float('') In-Reply-To: <1465396464.66.0.148764915141.issue27268@psf.upfronthosting.co.za> Message-ID: <1472747179.71.0.0886387799466.issue27268@psf.upfronthosting.co.za> Raymond Hettinger added the comment: Setting this aside for Nofar to review. ---------- assignee: -> rhettinger nosy: +rhettinger _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:35:53 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Thu, 01 Sep 2016 16:35:53 +0000 Subject: [issue27933] functools.lru_cache seems to not work when renaming decorated functions In-Reply-To: <1472746124.57.0.326377422927.issue27933@psf.upfronthosting.co.za> Message-ID: <1472747753.43.0.0996727547652.issue27933@psf.upfronthosting.co.za> Steven D'Aprano added the comment: This behaviour is expected. The factorial function calls itself, it doesn't call "f", but it is "f" which has the cache. So the call to f() goes through the cache, misses, and then calls factorial(), which has no cache. In effect, what you have written is something like: def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) def f(n): if n in f.cache: return f.cache[n] else: x = f.cache[n] = factorial(n) return x f.cache = lru_cache() ---------- nosy: +steven.daprano _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:39:53 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Thu, 01 Sep 2016 16:39:53 +0000 Subject: [issue27933] functools.lru_cache seems to not work when renaming decorated functions In-Reply-To: <1472746124.57.0.326377422927.issue27933@psf.upfronthosting.co.za> Message-ID: <1472747993.03.0.4957284443.issue27933@psf.upfronthosting.co.za> Steven D'Aprano added the comment: In case it isn't obvious, my example is meant to be pseudo-code, not the exact implementation used. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 12:55:45 2016 From: report at bugs.python.org (Israel Fruchter) Date: Thu, 01 Sep 2016 16:55:45 +0000 Subject: [issue27376] Add mock_import method to mock module In-Reply-To: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> Message-ID: <1472748945.59.0.202730927327.issue27376@psf.upfronthosting.co.za> Israel Fruchter added the comment: Some real use cases is needed, like testing a code that behave differently on case of package availability. I think something like patch for modules can be useful here, so you could have some control on what would be returned. ---------- nosy: +fruch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 13:06:26 2016 From: report at bugs.python.org (Matthias Klose) Date: Thu, 01 Sep 2016 17:06:26 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472749586.4.0.444831850093.issue27917@psf.upfronthosting.co.za> Matthias Klose added the comment: here's a patch, not yet including the ABI levels. I think we didn't need them for Linux, and maybe start for Android without using them. You can later introduce these if you have to. ---------- keywords: +patch Added file: http://bugs.python.org/file44327/android.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 13:12:39 2016 From: report at bugs.python.org (Elias Zamaria) Date: Thu, 01 Sep 2016 17:12:39 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472749959.93.0.314983539088.issue27923@psf.upfronthosting.co.za> Elias Zamaria added the comment: I tried running `hg import --no-commit "$(xclip -o)"` and got the following result: bash: xclip: command not found abort: need at least one patch to import I am using OS X 10.11.6 and Mercurial 3.8.2. I did a bit of quick research on xclip, but it looks like yet another unfamiliar tool, and I don't know exactly what it does or how it is supposed to help me. I looked at your suggestions for my patch, and I am working on them. I am planning to look at the tutorial, and to look for, and maybe fix, deprecated calls, but so far, I don't have a clear idea how long it will take me, or if it is realistic for one person to do it. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 13:48:54 2016 From: report at bugs.python.org (Chi Hsuan Yen) Date: Thu, 01 Sep 2016 17:48:54 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472752134.78.0.0564119974035.issue27917@psf.upfronthosting.co.za> Chi Hsuan Yen added the comment: Well, here's a list of cross compilers in Android NDK: $ ls $ANDROID_NDK/toolchains/*/prebuilt/*/bin/*-gcc | xargs -i basename '{}' aarch64-linux-android-gcc arm-linux-androideabi-gcc mips64el-linux-android-gcc mipsel-linux-android-gcc i686-linux-android-gcc x86_64-linux-android-gcc Does Python's platform triplet have the same meaning as GCC's --target? If so those names can be used. By the way, +1 for not including the API level. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 13:55:44 2016 From: report at bugs.python.org (Roundup Robot) Date: Thu, 01 Sep 2016 17:55:44 +0000 Subject: [issue27919] Deprecate and remove extra_path distribution kwarg In-Reply-To: <1472670374.61.0.857588658064.issue27919@psf.upfronthosting.co.za> Message-ID: <20160901175540.16442.17444.500EA003@psf.io> Roundup Robot added the comment: New changeset 94710cbcac47 by Jason R. Coombs in branch 'default': Issue #27919: Deprecate extra_path option in distutils. https://hg.python.org/cpython/rev/94710cbcac47 ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 13:56:37 2016 From: report at bugs.python.org (Aviv Palivoda) Date: Thu, 01 Sep 2016 17:56:37 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <1472752597.45.0.658175459515.issue27881@psf.upfronthosting.co.za> Aviv Palivoda added the comment: What do you think about removing the isolation_level member from the pysqlite_Connection. It is only there to be for the pysqlite_connection_get_isolation_level and that could be easily calculated from the begin_statement. ---------- Added file: http://bugs.python.org/file44328/issue27881_v5.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:03:54 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Thu, 01 Sep 2016 18:03:54 +0000 Subject: [issue27919] Deprecate and remove extra_path distribution kwarg In-Reply-To: <1472670374.61.0.857588658064.issue27919@psf.upfronthosting.co.za> Message-ID: <1472753034.21.0.00435700064915.issue27919@psf.upfronthosting.co.za> Jason R. Coombs added the comment: Thanks, Nick. I've also observed that the package that was mentioned in the comments was "Numeric Python" and I confirmed that numpy is not currently using this option, so that's a positive indication that it's unneeded. I've also reached out to New Relic and invited them to comment here about the value they get (if any) from the option. I've committed the deprecation warning as well. I'll plan to mirror this deprecation warning in Setuptools to get faster feedback. I'm open to reverting this change before the final release of Python 3.6 if it turns out to be a necessary feature. As for your first suggestion - having Setuptools disable the behavior, I'm not sure Setuptools has the context to disable the behavior, because at the time pip is invoking the install command, Setuptools doesn't know whether pip is going to install the packages into platlib or elsewhere. At least, that's my presumption; I haven't dived into the code. I'm okay with not having a workaround if later versions of Setuptools and Python can disable the functionality without breaking anything but the most obscure packages. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:13:57 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Thu, 01 Sep 2016 18:13:57 +0000 Subject: [issue901727] extra_path kwarg to setup() undocumented Message-ID: <1472753637.27.0.325999872851.issue901727@psf.upfronthosting.co.za> Jason R. Coombs added the comment: Given the progression in issue27919, I suggest this documentation effort can be dropped, but feel free to revive the conversation if you disagree. ---------- nosy: +jason.coombs resolution: -> wont fix status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:19:14 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 18:19:14 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472753954.38.0.698723072474.issue27923@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: I'm not convinced that the zeros() method is needed. Zero-initialized sequences can be created via sequence repetition. Sorry, but arguments against this sound like "we made bad design decision in the past, let repeat it with new name" to me. In any case if you want to write a code for different Python versions you should use sequence repetition. Here is a patch that replaces all creations of zero-initialized bytes and bytearray objects in the stdlib and tests with repetitions. All tests (except test_bytes of course) are passed on Linux if disallow an int argument in bytes and bytearray constructors. ---------- nosy: +serhiy.storchaka Added file: http://bugs.python.org/file44329/no_bytes_from_int.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:19:19 2016 From: report at bugs.python.org (Bernard Spil) Date: Thu, 01 Sep 2016 18:19:19 +0000 Subject: [issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0 In-Reply-To: <1456920893.87.0.933592382559.issue26470@psf.upfronthosting.co.za> Message-ID: <1472753959.08.0.615645619709.issue26470@psf.upfronthosting.co.za> Bernard Spil added the comment: Hi Christian, Great stuff! Please can you replace the HAVE_RAND_EGD ifdefs into OPENSSL_NO_EGD checks? Then the RAND_egd checks in configure.ac can also be removed. This was introduced by OpenSSL in https://github.com/openssl/openssl/commit/0423f812dc61f70c6ae6643191259ca9e5692c7f and is consistent with the naming in LibreSSL. Cheers, Bernard. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:25:39 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 18:25:39 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <1472754339.52.0.610783059089.issue27881@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: Yes, I thought about this. This changes the behavior (for now isolation_level returns exactly the same object that was assigned to it) and slows down the getter. This can be added only on the default branch. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:25:55 2016 From: report at bugs.python.org (Roundup Robot) Date: Thu, 01 Sep 2016 18:25:55 +0000 Subject: [issue27888] Hide pip install/uninstall windows in setup In-Reply-To: <1472503775.99.0.744395565983.issue27888@psf.upfronthosting.co.za> Message-ID: <20160901182546.22337.43082.5F85A201@psf.io> Roundup Robot added the comment: New changeset e065aec0e6fa by Steve Dower in branch '2.7': Issue #27888: Prevent Windows installer from displaying console windows and failing when pip cannot be installed/uninstalled. https://hg.python.org/cpython/rev/e065aec0e6fa ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:37:26 2016 From: report at bugs.python.org (Ethan Furman) Date: Thu, 01 Sep 2016 18:37:26 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472755046.34.0.18134173278.issue27923@psf.upfronthosting.co.za> Ethan Furman added the comment: Two things to note: - there is no need to change the stdlib to use anything besides the default constructor -- it's not going away, and it already works (my apologies if I misunderstood) - PEP 467 has not yet been accepted (unless I missed that?) However, thank you for getting some code written! ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:40:43 2016 From: report at bugs.python.org (Matthias Klose) Date: Thu, 01 Sep 2016 18:40:43 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472755243.47.0.998756376551.issue27917@psf.upfronthosting.co.za> Matthias Klose added the comment: yes, it should follow the gnu triplets. I updated these, and added some for mips. However I can't check if the mips ones will do what they are supposed to do. Please could you check these if you have cross compilers available? ---------- Added file: http://bugs.python.org/file44330/android.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:41:15 2016 From: report at bugs.python.org (Matthias Klose) Date: Thu, 01 Sep 2016 18:41:15 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472755275.93.0.06332642457.issue27917@psf.upfronthosting.co.za> Changes by Matthias Klose : Removed file: http://bugs.python.org/file44327/android.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:44:15 2016 From: report at bugs.python.org (=?utf-8?b?0KTQtdC00L7RgCDQm9GP0L3Qs9GD0LfQvtCy?=) Date: Thu, 01 Sep 2016 18:44:15 +0000 Subject: [issue27933] functools.lru_cache seems to not work when renaming decorated functions In-Reply-To: <1472746124.57.0.326377422927.issue27933@psf.upfronthosting.co.za> Message-ID: <1472755455.65.0.254767778967.issue27933@psf.upfronthosting.co.za> ????? ???????? added the comment: Ok, thank you very much, i've got a little smarter today. Now i understand, that user_function (in this case factorial) is not modified by decorator, it is my job to change factorial to wrapper by assignment. Enlightning. ---------- resolution: -> not a bug status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 14:49:41 2016 From: report at bugs.python.org (Aviv Palivoda) Date: Thu, 01 Sep 2016 18:49:41 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <1472755781.79.0.488402358284.issue27881@psf.upfronthosting.co.za> Aviv Palivoda added the comment: The only change I see that can happen is that we return upper case isolation level when the user used a lower case. I think that it is worth to slow down the getter for the code simplification. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:00:52 2016 From: report at bugs.python.org (Aviv Palivoda) Date: Thu, 01 Sep 2016 19:00:52 +0000 Subject: [issue16379] SQLite error code not exposed to python In-Reply-To: <1351764878.68.0.13361347428.issue16379@psf.upfronthosting.co.za> Message-ID: <1472756452.36.0.153083095569.issue16379@psf.upfronthosting.co.za> Changes by Aviv Palivoda : Added file: http://bugs.python.org/file44331/16379-3.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:22:06 2016 From: report at bugs.python.org (Roundup Robot) Date: Thu, 01 Sep 2016 19:22:06 +0000 Subject: [issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level In-Reply-To: <1472325689.42.0.337900232121.issue27881@psf.upfronthosting.co.za> Message-ID: <20160901192203.8356.78970.B8741F07@psf.io> Roundup Robot added the comment: New changeset 546b1f70cbed by Serhiy Storchaka in branch '3.5': Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. https://hg.python.org/cpython/rev/546b1f70cbed New changeset 96e05f1af2c8 by Serhiy Storchaka in branch 'default': Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. https://hg.python.org/cpython/rev/96e05f1af2c8 ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:25:00 2016 From: report at bugs.python.org (Elias Zamaria) Date: Thu, 01 Sep 2016 19:25:00 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472757900.09.0.962127233946.issue27923@psf.upfronthosting.co.za> Elias Zamaria added the comment: Here is a patch with all of my latest changes, including the changes that Martin suggested for the tests. ---------- Added file: http://bugs.python.org/file44332/pep467_attempt2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:25:58 2016 From: report at bugs.python.org (Chi Hsuan Yen) Date: Thu, 01 Sep 2016 19:25:58 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472757958.28.0.349815835701.issue27917@psf.upfronthosting.co.za> Chi Hsuan Yen added the comment: CPython builds fine for MIPS with this patch. For MIPS64, apparently Android NDK is broken - it can't even compile a simple C file. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:27:35 2016 From: report at bugs.python.org (Stefan Behnel) Date: Thu, 01 Sep 2016 19:27:35 +0000 Subject: [issue22881] show median in benchmark results In-Reply-To: <1416131417.96.0.330173729737.issue22881@psf.upfronthosting.co.za> Message-ID: <1472758055.77.0.774858523417.issue22881@psf.upfronthosting.co.za> Changes by Stefan Behnel : ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:28:28 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 19:28:28 +0000 Subject: [issue27921] f-strings: do not allow backslashes In-Reply-To: <1472687380.69.0.18258745604.issue27921@psf.upfronthosting.co.za> Message-ID: <1472758108.37.0.971372690221.issue27921@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: > - result.append(f' [Previous line repeated {count-3} more times]\n') > + result.append(f' [Previous line repeated {count-3} more times]''\n') This looks a little ugly. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:41:46 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Sep 2016 19:41:46 +0000 Subject: [issue27925] Nicer interface to convert hashlib digests to int In-Reply-To: <1472718708.44.0.588974083433.issue27925@psf.upfronthosting.co.za> Message-ID: <1472758906.64.0.899298103912.issue27925@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: There is another way: int.from_bytes(x.digest(), 'big') Note that converting to int you lose the length of the digest. md5 digest d41d8cd98f00b204e9800998ecf8427e and sha1 digest 00000000d41d8cd98f00b204e9800998ecf8427e are converted to the same int. This can add a vulnerability. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:42:44 2016 From: report at bugs.python.org (Chi Hsuan Yen) Date: Thu, 01 Sep 2016 19:42:44 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472758964.96.0.0781618128893.issue27917@psf.upfronthosting.co.za> Chi Hsuan Yen added the comment: OK found some wrong usages in my build script. Now MIPS64 builds fine, and PLATFORM_TRIPLET is detected as intended. I didn't test the build on actual devices, as I don't have a MIPS or MIPS64 device. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 15:44:06 2016 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 01 Sep 2016 19:44:06 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472746701.16.0.281410260843.issue27928@psf.upfronthosting.co.za> Message-ID: Gregory P. Smith added the comment: Rather than PyArg_ParseTupleAndKeywords can you have it use argument clinic? Also, how about making all arguments other than password be keyword only so that code calling the function is more clear. Otherwise it's a bit of positional argument soup with a lot of integers and potential to invert password and salt without realizing it. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:02:22 2016 From: report at bugs.python.org (Matthias Klose) Date: Thu, 01 Sep 2016 20:02:22 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472760142.53.0.185593733425.issue27917@psf.upfronthosting.co.za> Matthias Klose added the comment: I think that's good for now. The compiler checks maybe can be later adjusted. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:05:32 2016 From: report at bugs.python.org (Roundup Robot) Date: Thu, 01 Sep 2016 20:05:32 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <20160901200527.16401.37460.0A91D6FF@psf.io> Roundup Robot added the comment: New changeset a931fdc4c4c4 by doko in branch 'default': - Issue #27917: Set platform triplets for Android builds. https://hg.python.org/cpython/rev/a931fdc4c4c4 ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:06:08 2016 From: report at bugs.python.org (Matthias Klose) Date: Thu, 01 Sep 2016 20:06:08 +0000 Subject: [issue27917] Choose platform triplets for android builds In-Reply-To: <1472664182.04.0.808044107664.issue27917@psf.upfronthosting.co.za> Message-ID: <1472760368.01.0.282265991869.issue27917@psf.upfronthosting.co.za> Matthias Klose added the comment: checked in. ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:20:23 2016 From: report at bugs.python.org (Eddie James) Date: Thu, 01 Sep 2016 20:20:23 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double Message-ID: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> New submission from Eddie James: JSON does not correctly encode dbus.Double types, even though all other dbus types are handled fine. I end up with output like this (0.25 is the floating point value): dbus.Double(0.25, variant_level=1) Found that the encoding uses repr() for float objects but uses str() for integer objects. I propose a change to use str() for float objects as well. This could be ported back to 2.7 as well ---------- components: Library (Lib) files: json-float-str-default.patch keywords: patch messages: 274179 nosy: eajames priority: normal severity: normal status: open title: json float encoding incorrect for dbus.Double type: behavior versions: Python 2.7, Python 3.6 Added file: http://bugs.python.org/file44333/json-float-str-default.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:23:47 2016 From: report at bugs.python.org (Eddie James) Date: Thu, 01 Sep 2016 20:23:47 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472761427.2.0.452759304313.issue27934@psf.upfronthosting.co.za> Changes by Eddie James : Added file: http://bugs.python.org/file44334/json-float-str-2.7.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:27:50 2016 From: report at bugs.python.org (Christian Heimes) Date: Thu, 01 Sep 2016 20:27:50 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472761670.74.0.878408623395.issue27928@psf.upfronthosting.co.za> Christian Heimes added the comment: Argument is easy. Your second request is a very good idea but also harder to implement. Neither PyArg_Parse nor clinic have a way to declare arguments that required and keyword only but have no default value. I have a workaround but it ain't beautiful. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:32:39 2016 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 01 Sep 2016 20:32:39 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472761959.52.0.228954608634.issue27928@psf.upfronthosting.co.za> Gregory P. Smith added the comment: If clinic doesn't support required keyword only args then don't worry about it for now. :) ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 17:01:26 2016 From: report at bugs.python.org (Steve Newcomb) Date: Thu, 01 Sep 2016 21:01:26 +0000 Subject: [issue27898] regexp performance degradation between 2.7.6 and 2.7.12 In-Reply-To: <25e15524-06ae-5739-bdb0-7dc7ae77371c@coolheads.com> Message-ID: Steve Newcomb added the comment: Oops. The correct url is sftp://coolheads.com/files/py-re-perform-276v2712/ On 09/01/2016 04:52 PM, Steve Newcomb wrote: > On 08/30/2016 12:46 PM, Raymond Hettinger wrote: >> Raymond Hettinger added the comment: >> >> It would be helpful if you ... make a small set of regular >> expressions that demonstrate the performance regression. >> > Done. Attachments: > > test.py : Code that exercises re.sub() and outputs a profile report. > > test_output_2.7.6.txt : Output of test.py under Python 2.7.6. > > test_output_2.7.12.txt : Output of test.py under Python 2.7.12. > > p17.188.htm -- test data: public information from the U.S. Internal > Revenue Service. > > Equivalent hardware was used in both cases. > > The outputs show that 2.7.12's re.sub() takes 1.2 times as long as > 2.7.6's. It's a significant difference, but... > > ...it was not the dramatic degradation I expected to find in this > exercise. Therefore I attempted to tease what I was looking for out > of the profile stats I already uploaded to this site, made from actual > production runs. My attempts are all found in an hg repository that > can be downloaded from > sftp://sftp at coolheads.com//files/py-re-perform-276-2712 using password > bysIe20H . > > I do not feel the latter work took me where I wanted to go, and I > think the reason is that, at least for purposes of our application, > Python 2.7.12 has been so extensively refactored since Python 2.7.6. > So it's an apples-to-oranges comparison, apparently. Still, the > performance difference for re.sub() is quite dramatic , and re.sub() > is the only comparable function whose performance dramatically > worsened: in our application, 2.7.12's re.sub() takes 3.04 times as > long as 2.7.6's. > > The good news, of course, is that by and large the performance of the > other *comparable* functions largely improved, often dramatically. > But at least in our application, it doesn't come close to making up > for the degradation in re.sub(). > > My by-the-gut bottom line: somebody who really knows the re module > should take a deep look at re.sub(). Why would re.sub(), unlike all > others, take so much longer to run, while *every* other function in > the re module get (often much) faster? It feels like there's a bug > somewhere in re.sub(). > > Steve Newcomb > ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 17:18:35 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 21:18:35 +0000 Subject: [issue27898] regexp performance degradation between 2.7.6 and 2.7.12 In-Reply-To: <1472574470.7.0.512575721216.issue27898@psf.upfronthosting.co.za> Message-ID: <1472764715.51.0.67798239298.issue27898@psf.upfronthosting.co.za> Changes by STINNER Victor : ---------- nosy: +haypo type: -> performance _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 17:29:06 2016 From: report at bugs.python.org (Stefan Krah) Date: Thu, 01 Sep 2016 21:29:06 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472765346.37.0.535917390775.issue22458@psf.upfronthosting.co.za> Stefan Krah added the comment: I think string conversion should be part of this benchmark, or it should be renamed to fraction-arith or something. The formatting function can be a significant bottleneck, and if you use Fractions for financial calculations the result will still need to be printed in decimal floating point form. That said, is the purpose of this benchmark to show that fractions are slow and generate interest in changing the situation? ---------- nosy: +skrah _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 17:31:55 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 21:31:55 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1472765346.37.0.535917390775.issue22458@psf.upfronthosting.co.za> Message-ID: STINNER Victor added the comment: > I think string conversion should be part of this benchmark, or it should be renamed to fraction-arith or something. The "telco" benchmark seems to be standard and well defined. I agree that we should use a different name. > That said, is the purpose of this benchmark to show that fractions are slow and generate interest in changing the situation? I'm not really convinced that the benchmark is useful in the Python benchmark suite, but I'm not strongly opposed to adding it neither :-) ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 18:01:03 2016 From: report at bugs.python.org (Stefan Krah) Date: Thu, 01 Sep 2016 22:01:03 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472767263.07.0.349176375149.issue22458@psf.upfronthosting.co.za> Stefan Krah added the comment: I'm also not opposed to adding it (-0.000) as long as we rename it to bm_fractions.py and change the docstring to "based on the telco benchmark". ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 18:44:25 2016 From: report at bugs.python.org (Steve Dower) Date: Thu, 01 Sep 2016 22:44:25 +0000 Subject: [issue27888] Hide pip install/uninstall windows in setup In-Reply-To: <1472503775.99.0.744395565983.issue27888@psf.upfronthosting.co.za> Message-ID: <1472769865.03.0.476926255022.issue27888@psf.upfronthosting.co.za> Changes by Steve Dower : ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 19:06:05 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Sep 2016 23:06:05 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472771165.15.0.0338037012361.issue22458@psf.upfronthosting.co.za> STINNER Victor added the comment: @Stefan Krah: Please review the pull request. https://github.com/python/performance/pull/10 I suggested to only run the benchmark with the fractions module. I don't see the point of running the benchmark with the decimal module. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 19:30:19 2016 From: report at bugs.python.org (Doug Coleman) Date: Thu, 01 Sep 2016 23:30:19 +0000 Subject: [issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions In-Reply-To: <1280333027.17.0.112361474517.issue9400@psf.upfronthosting.co.za> Message-ID: <1472772619.92.0.727798275372.issue9400@psf.upfronthosting.co.za> Doug Coleman added the comment: Six years later and I'm still running into this exact bug with ``subprocess.CalledProcessError`` on python 2.7.12 when doing a ``multiprocessing.Pool.map`` and trying to catch errors from ``subprocess.check_output``. What's the reason it was never fixed and backported? ---------- nosy: +Doug Coleman _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 20:35:58 2016 From: report at bugs.python.org (Steve Newcomb) Date: Fri, 02 Sep 2016 00:35:58 +0000 Subject: [issue27898] regexp performance degradation between 2.7.6 and 2.7.12 In-Reply-To: Message-ID: <699f668b-c646-9fa1-620e-8596f413f23c@coolheads.com> Steve Newcomb added the comment: On 09/01/2016 05:01 PM, Steve Newcomb wrote: > >> The outputs show that 2.7.12's re.sub() takes 1.2 times as long as >> 2.7.6's. It's a significant difference, but... >> >> ...it was not the dramatic degradation I expected to find in this >> exercise. On second (third?) thought, the degree of degradation could easily depend on the source data being processed. Maybe test.py does, in fact, demonstrate the problem, but the test data I used (p17-118.htm) do not demonstrate a terribly severe case of the problem. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 20:59:16 2016 From: report at bugs.python.org (Tim Peters) Date: Fri, 02 Sep 2016 00:59:16 +0000 Subject: [issue27761] Private _nth_root function loses accuracy In-Reply-To: <1471141583.56.0.32662922065.issue27761@psf.upfronthosting.co.za> Message-ID: <1472777956.6.0.288344256592.issue27761@psf.upfronthosting.co.za> Tim Peters added the comment: Attched file "roots.py" you can run to get a guess as to how bad pow(x, 1/n) typically is on your box. Note that it's usually "pretty darned good" the larger `n` is. There's a reason for that. For example, when n=1000, all x satisfying 1 <= x < 2**1000 have a root r satisfying 1 <= r < 2. Mathematically, that's a 1-to-1 function, but in floating point there are only 2**52 representable r in the lstter range: the larger n, the more of a many-to-1 function the n'th root is in native floating point precision. That makes it much easier to get the best-possible result even by accident ;-) So, e.g., this kind of output is common for "large" n: n = 2272 x**(1/n) -1 10 0 982 1 8 with 1 native-precision step all correct with 1 extended-precision step all correct That means that, out of 1000 "random-ish" x, x**(1/2272) returned a result 1 ulp smaller than best-possible 10 times, 1 ulp too large 8 times, and best-possible 982 times ("ulp" is relative to the best-possible result). Doing any form of a single "guess + small_correction" Newton step (in either native or extended precision) repaired all the errors. Things look very different for small n. Like: n = 2 x**(1/n) -1 1 0 997 1 2 with 1 native-precision step -1 117 0 772 1 111 with 1 extended-precision step all correct 1/2 is exactly representable, so errors are few. But doing a native-precsion "correction" made results significantly worse. n=3 is more interesting, because 1/3 is not exactly representable: n = 3 x**(1/n) -55 1 -54 2 -53 2 -52 1 -51 3 -50 3 -49 2 -48 3 -47 4 -46 2 -45 6 -44 5 -43 7 -42 5 -41 6 -40 4 -39 7 -38 7 -37 8 -36 7 -35 5 -34 8 -33 8 -32 14 -31 8 -30 9 -29 15 -28 13 -27 21 -26 14 -25 7 -24 14 -23 15 -22 7 -21 18 -20 14 -19 12 -18 17 -17 8 -16 13 -15 15 -14 9 -13 10 -12 14 -11 11 -10 7 -9 10 -8 14 -7 11 -6 7 -5 11 -4 12 -3 12 -2 12 -1 8 0 12 1 7 2 11 3 11 4 12 5 5 6 9 7 14 8 12 9 8 10 14 11 15 12 13 13 12 14 9 15 15 16 17 17 9 18 10 19 17 20 15 21 9 22 9 23 6 24 11 25 20 26 24 27 21 28 16 29 11 30 12 31 3 32 11 33 12 34 11 35 11 36 2 37 8 38 8 39 9 40 3 41 5 42 4 43 7 44 4 45 7 46 5 47 3 48 4 50 2 53 3 54 3 56 1 with 1 native-precision step -1 42 0 917 1 41 with 1 extended-precision step all correct There a single native-precision step helped a lot overall. But for n=4 (where 1/n is again exactly representable), it again hurts: n = 4 x**(1/n) 0 999 1 1 with 1 native-precision step -1 50 0 894 1 56 with 1 extended-precision step all correct And at n=5 it helps again; etc. Of course my story hasn't changed ;-) That is, use the single-step extended-precision code. It's "almost always" correctly rounded (I still haven't seen a case where it isn't, and the test code here assert-fails if it finds one), and is plenty fast. The reason this code gets very visibly slower as `n` increases is due to using the always-correctly-rounded `nroot()` for comparison. ---------- Added file: http://bugs.python.org/file44339/roots.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 21:03:11 2016 From: report at bugs.python.org (Caleb Hattingh) Date: Fri, 02 Sep 2016 01:03:11 +0000 Subject: [issue15663] Investigate providing Tcl/Tk 8.6 with OS X installers In-Reply-To: <1345022434.53.0.691858342769.issue15663@psf.upfronthosting.co.za> Message-ID: <1472778191.72.0.94040304123.issue15663@psf.upfronthosting.co.za> Changes by Caleb Hattingh : ---------- nosy: +cjrh _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 21:17:09 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 01:17:09 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <20160902011706.57571.52863.9A5FBB5A@psf.io> Roundup Robot added the comment: New changeset 79422fab2ef4 by Jason R. Coombs in branch 'default': Issue #12885: Merge with 3.5 https://hg.python.org/cpython/rev/79422fab2ef4 ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 21:17:09 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 01:17:09 +0000 Subject: [issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool() In-Reply-To: <1307541329.07.0.743246465318.issue12285@psf.upfronthosting.co.za> Message-ID: <20160902011706.57571.97568.54CCF438@psf.io> Roundup Robot added the comment: New changeset 941346104718 by Jason R. Coombs in branch '3.4': Issue #12285: Add test capturing failure. https://hg.python.org/cpython/rev/941346104718 New changeset 56c60b3d06fb by Jason R. Coombs in branch '3.4': Issue #12285: Replace implementation of findall with implementation from Setuptools 7ce820d524db. https://hg.python.org/cpython/rev/56c60b3d06fb New changeset 13619a3e0737 by Jason R. Coombs in branch '3.4': Issue #12285: Update NEWS https://hg.python.org/cpython/rev/13619a3e0737 New changeset ade53661607a by Jason R. Coombs in branch '3.5': Issue #12285: Merge with 3.4 https://hg.python.org/cpython/rev/ade53661607a ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 21:27:07 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 02 Sep 2016 01:27:07 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <1472779627.6.0.410931191422.issue12885@psf.upfronthosting.co.za> Jason R. Coombs added the comment: This code has been stable in Setuptools for some time, so I've pushed the code into the base. ---------- resolution: -> fixed status: open -> closed versions: -Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 22:03:33 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 02 Sep 2016 02:03:33 +0000 Subject: [issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool() In-Reply-To: <1307541329.07.0.743246465318.issue12285@psf.upfronthosting.co.za> Message-ID: <1472781813.79.0.274047638982.issue12285@psf.upfronthosting.co.za> Martin Panter added the comment: Looks like that last lot was meant to reference Issue 12885 ---------- nosy: +martin.panter _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 22:05:16 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 02 Sep 2016 02:05:16 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <1472781916.35.0.433144182438.issue12885@psf.upfronthosting.co.za> Martin Panter added the comment: I think you mixed up the bug number. You should probably fix Misc/NEWS. New changeset 941346104718 by Jason R. Coombs in branch '3.4': Issue #12285: Add test capturing failure. https://hg.python.org/cpython/rev/941346104718 New changeset 56c60b3d06fb by Jason R. Coombs in branch '3.4': Issue #12285: Replace implementation of findall with implementation from Setuptools 7ce820d524db. https://hg.python.org/cpython/rev/56c60b3d06fb New changeset 13619a3e0737 by Jason R. Coombs in branch '3.4': Issue #12285: Update NEWS https://hg.python.org/cpython/rev/13619a3e0737 ---------- nosy: +martin.panter _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 22:07:31 2016 From: report at bugs.python.org (Tim Peters) Date: Fri, 02 Sep 2016 02:07:31 +0000 Subject: [issue27761] Private _nth_root function loses accuracy In-Reply-To: <1471141583.56.0.32662922065.issue27761@psf.upfronthosting.co.za> Message-ID: <1472782051.38.0.731172031082.issue27761@psf.upfronthosting.co.za> Tim Peters added the comment: BTW, add this other way of writing a native-precision Newton step to see that it's much worse (numerically) than writing it in the "guess + small_correction" form used in roots.py. Mathematically they're identical, but numerically they behave differently: def native2(x, n): g = x**(1.0/n) if g**n == x: return g return ((n-1)*g + x/g**(n-1)) / n ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 22:10:55 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 02:10:55 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <20160902021053.2964.72278.E27F9EB6@psf.io> Roundup Robot added the comment: New changeset 590d0de4ff48 by Jason R. Coombs in branch '3.4': Issue #12885: Correct issue reference in NEWS https://hg.python.org/cpython/rev/590d0de4ff48 New changeset 74ccec0bd442 by Jason R. Coombs in branch '3.5': Issue #12885: Merge 3.4 https://hg.python.org/cpython/rev/74ccec0bd442 New changeset bfff89ed356b by Jason R. Coombs in branch 'default': Issue #12885: Merge with 3.5 https://hg.python.org/cpython/rev/bfff89ed356b ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 22:20:26 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 02 Sep 2016 02:20:26 +0000 Subject: [issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool() In-Reply-To: <1307541329.07.0.743246465318.issue12285@psf.upfronthosting.co.za> Message-ID: <1472782826.42.0.432022943333.issue12285@psf.upfronthosting.co.za> Jason R. Coombs added the comment: Yep. Sorry for the misfile. ---------- nosy: +jason.coombs _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 23:29:44 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 03:29:44 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <20160902032941.90354.44722.3D4520F1@psf.io> Roundup Robot added the comment: New changeset e82b995d1a5c by Jason R. Coombs in branch '3.4': Issue #12885: Revert commits in 3.4 branch which is security-only fixes. https://hg.python.org/cpython/rev/e82b995d1a5c New changeset a7ce98a4e9e4 by Jason R. Coombs in branch '3.5': Issue #12885: Merge with 3.4, retaining commits reverted there. https://hg.python.org/cpython/rev/a7ce98a4e9e4 New changeset fa82fabe9d65 by Jason R. Coombs in branch 'default': Issue #12885: Merge with 3.5 https://hg.python.org/cpython/rev/fa82fabe9d65 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 23:30:49 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 02 Sep 2016 03:30:49 +0000 Subject: [issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x In-Reply-To: <1314971843.03.0.797964996491.issue12885@psf.upfronthosting.co.za> Message-ID: <1472787049.59.0.0617530819757.issue12885@psf.upfronthosting.co.za> Changes by Jason R. Coombs : ---------- versions: -Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 00:09:02 2016 From: report at bugs.python.org (Lisa Roach) Date: Fri, 02 Sep 2016 04:09:02 +0000 Subject: [issue27779] Sync-up docstrings in C version of the the decimal module In-Reply-To: <1471375735.77.0.977501297817.issue27779@psf.upfronthosting.co.za> Message-ID: <1472789342.47.0.227364470824.issue27779@psf.upfronthosting.co.za> Lisa Roach added the comment: I will start working on the patch for this! Thanks for pointing me this way, Raymond. ---------- nosy: +lisroach _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 00:30:55 2016 From: report at bugs.python.org (Robert Jordens) Date: Fri, 02 Sep 2016 04:30:55 +0000 Subject: [issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH In-Reply-To: <1472738395.77.0.643111482192.issue27929@psf.upfronthosting.co.za> Message-ID: <1472790655.67.0.740728106616.issue27929@psf.upfronthosting.co.za> Robert Jordens added the comment: https://github.com/python/cpython/blob/master/Lib/asyncio/selector_events.py#L394 https://github.com/python/asyncio/blob/master/asyncio/selector_events.py#L394 AF_UNIX is special-cased. Maybe AF_BLUETOOTH and others should use that same special treatment. Or maybe only AF_INET, AF_INET6 should attempt resolving. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 01:09:40 2016 From: report at bugs.python.org (Stefan Behnel) Date: Fri, 02 Sep 2016 05:09:40 +0000 Subject: [issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self" In-Reply-To: <1448654213.28.0.807225788685.issue25750@psf.upfronthosting.co.za> Message-ID: <1472792980.0.0.125541471809.issue25750@psf.upfronthosting.co.za> Stefan Behnel added the comment: I haven't seen any crashes in the wild here, but this is still the case in the latest code base. The change doesn't seem invasive, so I don't see why it shouldn't get implemented. ---------- nosy: +pitrou, scoder, serhiy.storchaka versions: +Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 01:19:04 2016 From: report at bugs.python.org (Stefan Behnel) Date: Fri, 02 Sep 2016 05:19:04 +0000 Subject: [issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions In-Reply-To: <1429386313.82.0.910239252026.issue23996@psf.upfronthosting.co.za> Message-ID: <1472793544.45.0.814808599038.issue23996@psf.upfronthosting.co.za> Stefan Behnel added the comment: Looks like I forgot about this. My final fix still hasn't been applied, so the code in Py3.4+ is incorrect now. No, this cannot be tested from the Python level. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 02:32:22 2016 From: report at bugs.python.org (=?utf-8?q?Ond=C5=99ej_Medek?=) Date: Fri, 02 Sep 2016 06:32:22 +0000 Subject: [issue27935] logging level FATAL missing in _nameToLevel Message-ID: <1472797942.24.0.349970976143.issue27935@psf.upfronthosting.co.za> New submission from Ond?ej Medek: logging.__init__._nameToLevel is missing 'FATAL' key: >>> logging.getLevelName('FATAL') 'Level FATAL' Expected same as: >>> logging.getLevelName('CRITICAL') 50 ---------- components: Library (Lib) messages: 274204 nosy: Ond?ej Medek priority: normal severity: normal status: open title: logging level FATAL missing in _nameToLevel type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 02:52:55 2016 From: report at bugs.python.org (Jonatan Skogsfors) Date: Fri, 02 Sep 2016 06:52:55 +0000 Subject: [issue27936] Inconsistent round behavior between float and int Message-ID: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> New submission from Jonatan Skogsfors: Theo error handling for round is different for float and int. Python 3.5.1 (default, Apr 18 2016, 11:46:32) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> round(1.0, None) 1 >>> round(1, None) Traceback (most recent call last): File "", line 1, in TypeError: 'NoneType' object cannot be interpreted as an integer ---------- messages: 274205 nosy: Jonatan Skogsfors priority: normal severity: normal status: open title: Inconsistent round behavior between float and int type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 02:55:41 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 06:55:41 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <20160902065536.26505.60032.A137B1C9@psf.io> Roundup Robot added the comment: New changeset adbc7eec97f1 by Ethan Furman in branch 'default': issue23591: add docs; code cleanup; more tests https://hg.python.org/cpython/rev/adbc7eec97f1 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 03:37:51 2016 From: report at bugs.python.org (SilentGhost) Date: Fri, 02 Sep 2016 07:37:51 +0000 Subject: [issue27935] logging level FATAL missing in _nameToLevel In-Reply-To: <1472797942.24.0.349970976143.issue27935@psf.upfronthosting.co.za> Message-ID: <1472801871.08.0.330462638358.issue27935@psf.upfronthosting.co.za> Changes by SilentGhost : ---------- nosy: +vinay.sajip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 03:45:15 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 07:45:15 +0000 Subject: [issue27931] Email parse IndexError <""@wiarcom.com> In-Reply-To: <1472743779.07.0.918992764498.issue27931@psf.upfronthosting.co.za> Message-ID: <1472802315.98.0.496788783754.issue27931@psf.upfronthosting.co.za> Xiang Zhang added the comment: Looking at the spec this is a valid angle addr. Not only et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].addr_spec but also et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].local_part fails for the same reason. The problem exists in get_bare_quoted_string. When encounter bare '""', it returns a empty BareQuoteString. I write issue27931.patch to fix this. ---------- keywords: +patch nosy: +xiang.zhang Added file: http://bugs.python.org/file44340/issue27931.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:13:46 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 02 Sep 2016 08:13:46 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472804026.23.0.217669017032.issue27936@psf.upfronthosting.co.za> Raymond Hettinger added the comment: The different data types make different choices: >>> from decimal import Decimal >>> from fractions import Fraction >>> (1).__round__(None) Traceback (most recent call last): File "", line 1, in (1).__round__(None) TypeError: 'NoneType' object cannot be interpreted as an integer >>> (1.0).__round__(None) 1 >>> Decimal(1).__round__(None) Traceback (most recent call last): File "", line 1, in Decimal(1).__round__(None) TypeError: optional arg must be an integer >>> Fraction(1, 1).__round__(None) 1 >>> from _pydecimal import Decimal >>> Decimal(1).__round__(None) 1 For Fraction and _pydecimal, the behavior comes from using None as a placeholder (which is common and normal in pure python code). For float there is explicit code to test for the None case. For int, the None test was omitted (perhaps a mistake) and the error is raised by PyNumber_Index. Looking through tests, only Lib/test/test_float.py tests for None being allowable. Elsewhere, it seems to be an implementation detail. The old Python 2 version of the round() function never let None be passed in (because it used PyArg_ParseTupleAndKeywords(args, kwds, "d|i:round"). That logic seems to get lost in the Python 3 version when __round__ was introduced. To resolve the differences, I think the round() function should explicitly check for None and replace it with zero before calling the underling __round__ functions where we would allow variable according the needs of the implementation. ---------- nosy: +rhettinger _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:17:25 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 02 Sep 2016 08:17:25 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472804245.15.0.912206754622.issue27936@psf.upfronthosting.co.za> Changes by Raymond Hettinger : ---------- keywords: +patch Added file: http://bugs.python.org/file44341/fix_round_default_none.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:25:05 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 02 Sep 2016 08:25:05 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472804705.26.0.281108575047.issue27936@psf.upfronthosting.co.za> Changes by Raymond Hettinger : Added file: http://bugs.python.org/file44342/fix_round_default_none_with_test.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:25:14 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 02 Sep 2016 08:25:14 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472804714.34.0.431540158634.issue27936@psf.upfronthosting.co.za> Changes by Raymond Hettinger : Removed file: http://bugs.python.org/file44341/fix_round_default_none.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:30:59 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 08:30:59 +0000 Subject: [issue27935] logging level FATAL missing in _nameToLevel In-Reply-To: <1472797942.24.0.349970976143.issue27935@psf.upfronthosting.co.za> Message-ID: <1472805059.55.0.227502795178.issue27935@psf.upfronthosting.co.za> Xiang Zhang added the comment: Though FATAL is not mentioned in the doc, but I think it should be added to getLevelName, just like how WARN is handled now: >>> logging.getLevelName("WARN") 30 ---------- keywords: +patch nosy: +xiang.zhang Added file: http://bugs.python.org/file44343/issue27935.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:33:08 2016 From: report at bugs.python.org (=?utf-8?q?Ond=C5=99ej_Medek?=) Date: Fri, 02 Sep 2016 08:33:08 +0000 Subject: [issue27937] logging.getLevelName microoptimization Message-ID: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> New submission from Ond?ej Medek: The logging.getLevelName contains code: return _levelToName.get(level, _nameToLevel.get(level, ("Level %s" % level))) I am still a Python beginner, but I think the most of the times the _nameToLevel.get is called unnecessarily. IMHO the code should be return _levelToName.get(level, (_nameToLevel.get(level, ("Level %s" % level)))) or maybe better a classic if then style: result = _levelToName.get(level) if result is None: result = _nameToLevel.get(level, ("Level %s" % level)) return result Since this function is called every time the LogRecord is created, I think it should be microoptimized. ---------- components: Library (Lib) messages: 274210 nosy: Ond?ej Medek priority: normal severity: normal status: open title: logging.getLevelName microoptimization type: performance versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:46:38 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 08:46:38 +0000 Subject: [issue27937] logging.getLevelName microoptimization In-Reply-To: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> Message-ID: <1472805998.88.0.813083602726.issue27937@psf.upfronthosting.co.za> Xiang Zhang added the comment: What's the meaning of the first method? ---------- nosy: +xiang.zhang _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:50:47 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 08:50:47 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472806247.48.0.453389442443.issue27936@psf.upfronthosting.co.za> Mark Dickinson added the comment: > I think the round() function should explicitly check for None and replace it with zero That would be a change in behaviour: `round(x)` is not the same as `round(x, 0)`. For most types, `round(x)` returns an `int`, while `round(x, 0)` returns something of the same type as `x`. Instead, I think we should add the check for `None` to `int`s `__round__` implementation. >>> round(1.3, 0) 1.0 >>> round(1.3) 1 >>> round(1.3, None) 1 ---------- nosy: +mark.dickinson _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:52:49 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 08:52:49 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472806369.3.0.426872669792.issue27936@psf.upfronthosting.co.za> Mark Dickinson added the comment: Ah, sorry; now that I've looked at the patch, I see I misunderstood. You're not replacing None with zero; you're replacing it with NULL. Patch LGTM. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 04:55:34 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 08:55:34 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472806534.1.0.583479394968.issue27936@psf.upfronthosting.co.za> Mark Dickinson added the comment: The test could be strengthened to add a check that the types of `round(x)` and `round(x, None)` match. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:03:28 2016 From: report at bugs.python.org (=?utf-8?q?Ond=C5=99ej_Medek?=) Date: Fri, 02 Sep 2016 09:03:28 +0000 Subject: [issue27937] logging.getLevelName microoptimization In-Reply-To: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> Message-ID: <1472807008.58.0.0615741645254.issue27937@psf.upfronthosting.co.za> Ond?ej Medek added the comment: Which 'first' method do you mean? logging.getLevelName() converts level (int) to level name (str). But due to the backward compatibility is also converts level name (str) to level (int). ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:06:22 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 09:06:22 +0000 Subject: [issue27937] logging.getLevelName microoptimization In-Reply-To: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> Message-ID: <1472807182.14.0.591948111031.issue27937@psf.upfronthosting.co.za> Xiang Zhang added the comment: No, I mean this method you propose: return _levelToName.get(level, (_nameToLevel.get(level, ("Level %s" % level)))) I cannot see any difference with the original code, except parentheses. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:07:36 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 09:07:36 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472807256.93.0.619587635907.issue27928@psf.upfronthosting.co.za> Christian Heimes added the comment: Here is a new patch with argument clinic, more tests and required keyword arguments. ---------- Added file: http://bugs.python.org/file44344/Add-hashlib.scrypt-2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:11:53 2016 From: report at bugs.python.org (=?utf-8?q?Ond=C5=99ej_Medek?=) Date: Fri, 02 Sep 2016 09:11:53 +0000 Subject: [issue27937] logging.getLevelName microoptimization In-Reply-To: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> Message-ID: <1472807513.21.0.271809113085.issue27937@psf.upfronthosting.co.za> Ond?ej Medek added the comment: That's probably my lack of Python knowledge. I have though that parentheses in ("Level %s" % level) cause lazy evaluation. If not, then this code has to be optimized by if-then, too. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:14:33 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 09:14:33 +0000 Subject: [issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0 In-Reply-To: <1456920893.87.0.933592382559.issue26470@psf.upfronthosting.co.za> Message-ID: <1472807673.23.0.0681786978933.issue26470@psf.upfronthosting.co.za> Christian Heimes added the comment: Bernard, where do you see HAVE_RAND_EGD in my patch or in any recent version of _ssl.c? There is no reference to HAVE_RAND_EGD. The patches use OPENSSL_NO_EGD. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:25:58 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 09:25:58 +0000 Subject: [issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0 In-Reply-To: <1456920893.87.0.933592382559.issue26470@psf.upfronthosting.co.za> Message-ID: <1472808358.16.0.0265782825256.issue26470@psf.upfronthosting.co.za> Christian Heimes added the comment: Yes, I plan to change this for Python 3.7 along with #27876. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 05:51:25 2016 From: report at bugs.python.org (Stefan Krah) Date: Fri, 02 Sep 2016 09:51:25 +0000 Subject: [issue27779] Sync-up docstrings in C version of the the decimal module In-Reply-To: <1471375735.77.0.977501297817.issue27779@psf.upfronthosting.co.za> Message-ID: <1472809885.4.0.420565977985.issue27779@psf.upfronthosting.co.za> Stefan Krah added the comment: "hand written signatures" refers to the signatures that Argument Clinic would generate if it were used (but I don't want that). So this is an example of a hand written signature: "is_infinite($self, /)\n--\n\n\" I still wonder if people wouldn't be served better with concise docstrings, but then I'm generally in favor of a Unix manual page documentation style, so perhaps there's a cultural difference. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:19:34 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 10:19:34 +0000 Subject: [issue27938] PyUnicode_AsEncodedString, PyUnicode_Decode: add fast-path for "us-ascii" encoding Message-ID: <1472811574.16.0.472581628747.issue27938@psf.upfronthosting.co.za> New submission from STINNER Victor: The "us-ascii" encoding is an alias to the Python ASCII encoding. PyUnicode_AsEncodedString() and PyUnicode_Decode() functions have a fast-path for the "ascii" string, but not for "us-ascii". Attached patch uses also the fast-path for "us-ascii". It's a more generic change than the issue #27915. The "us-ascii" name is common in the email and xml.etree modules. Other changes of the patch: * Rewrite _Py_normalize_encoding() as a C implementation of encodings.normalize_encoding(). For example, " utf-8 " is now normalized to "utf_8". So the fast path is now used for more name variants of the same encoding. * Avoid strcpy() when encoding is NULL: call directly the UTF-8 codec * Reorder encodings: UTF-8, ASCII, MBCS, Latin1, UTF-16 * Remove fast-path for UTF-32: seriously, nobody uses this codec. Latin9 is much faster but has no fast-path. ---------- components: Interpreter Core, Unicode files: normalize_encoding.patch keywords: patch messages: 274222 nosy: ezio.melotti, haypo, scop, serhiy.storchaka priority: normal severity: normal status: open title: PyUnicode_AsEncodedString, PyUnicode_Decode: add fast-path for "us-ascii" encoding type: performance versions: Python 3.6 Added file: http://bugs.python.org/file44345/normalize_encoding.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:20:34 2016 From: report at bugs.python.org (Goyo) Date: Fri, 02 Sep 2016 10:20:34 +0000 Subject: [issue27939] Tkinter mainloop raises when setting the value of ttk.LabeledScale Message-ID: <1472811634.57.0.400970918265.issue27939@psf.upfronthosting.co.za> New submission from Goyo: Calling mainloop after setting the value of a ttk.LabeledScale raises an error. The same happens if the value is set after entering the mainloop. Does not affect python 3.4.3. Does not affect ttk.Scale. No error is raised if you do not call mainloop. import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() w = ttk.LabeledScale(root) w.pack() w.scale.set(1) root.mainloop() Traceback (most recent call last): File "d:\users\u938001\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1550, in __call__ return self.func(*args) File "d:\users\u938001\AppData\Local\Programs\Python\Python35-32\lib\tkinter\ttk.py", line 1540, in _adjust newval = self._variable.get() File "d:\users\u938001\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 355, in get return self._tk.getint(self._tk.globalgetvar(self._name)) TypeError: getint() argument must be str, not float During handling of the above exception, another exception occurred: Traceback (most recent call last): File "itcomp.py", line 8, in root.mainloop() File "d:\users\u938001\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1131, in mainloop self.tk.mainloop(n) File "d:\users\u938001\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1554, in __call__ self.widget._report_exception() AttributeError: 'IntVar' object has no attribute '_report_exception' ---------- components: Tkinter messages: 274223 nosy: goyodiaz priority: normal severity: normal status: open title: Tkinter mainloop raises when setting the value of ttk.LabeledScale type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:37:33 2016 From: report at bugs.python.org (Bernard Spil) Date: Fri, 02 Sep 2016 10:37:33 +0000 Subject: [issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0 In-Reply-To: <1456920893.87.0.933592382559.issue26470@psf.upfronthosting.co.za> Message-ID: <1472812653.53.0.440322965941.issue26470@psf.upfronthosting.co.za> Bernard Spil added the comment: Sorry for the noise Christian, I thought the former EGD handling was still in place. That was fixed with https://github.com/python/cpython/commit/968ec1d29b44ca7a600df5984adff00a78392368 on 07 Jul 2016 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:41:29 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 10:41:29 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472812889.09.0.0797360477451.issue27928@psf.upfronthosting.co.za> Xiang Zhang added the comment: It looks that new patch when used like this hashlib.scrypt(b'password') will generate a "an integer is required" exception message which is misleading. I don't test it since I don't get openssl 1.1. And the phrase "interpreted as buffers of bytes" in the doc may better be "bytes-like objects". ---------- nosy: +xiang.zhang _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:42:48 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 10:42:48 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472812968.08.0.712438118279.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: > I propose a change to use str() for float objects as well. This could be ported back to 2.7 as well That would be a behaviour change for 2.7, and an undesirable one. `str` loses precision in Python 2, so e.g., `json.loads(json.dumps(pi)) == pi` would no longer be true. (Indeed, the json library was changed to use `repr` rather than `str` for floats at some point in the past, for exactly this reason.) I assume that dbus.Double is a subclass of float. Is that correct? If that's the case, I'm a bit confused: `float.__repr__` behaves identically to `float.__str__` in Python versions >= 3.2, so I don't see what your suggested change would achieve. >>> class MyFloat(float): ... def __repr__(self): return "MyFloat(something_or_other)" ... def __str__(self): return "1729.0" ... >>> x = MyFloat(2.3) >>> import json >>> json.dumps(x) '2.3' ---------- nosy: +mark.dickinson _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 06:57:59 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 10:57:59 +0000 Subject: [issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding Message-ID: <1472813879.44.0.998977479164.issue27940@psf.upfronthosting.co.za> New submission from STINNER Victor: The ElementTree module (xml.etree) avoids the XML declaration for "utf-8" and "us-ascii" codecs, but not for the "ascii" encoding. Attached patch avoids the XML declaration for the "ascii" codec since it's a subset of UTF-8 and UTF-8 is the default encoding of XML. The patch also normalizes the encoding name to handle aliases like "utf8" (UTF-8) or "us_ascii" (ASCII). The patch adds unit tests. -- By the way, I'm surprised that the special encoding "unicode" relies on the *current* locale encoding when the XML declaration is requested. Why not alway susing UTF-8 for *unicode* instead of the locale encoding? My unit test tests different locale encodings. ---------- components: XML files: etree_xml_declaration.patch keywords: patch messages: 274227 nosy: haypo priority: normal severity: normal status: open title: xml.etree: Avoid XML declaration for the "ascii" encoding type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file44346/etree_xml_declaration.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:00:26 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 11:00:26 +0000 Subject: [issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding In-Reply-To: <1472813879.44.0.998977479164.issue27940@psf.upfronthosting.co.za> Message-ID: <1472814026.43.0.912922769639.issue27940@psf.upfronthosting.co.za> STINNER Victor added the comment: Note: I found the "us-ascii" special case when reviewing the issue #27915 which proposed to replace "us-ascii" with "ascii" in the xml.etree module to use the Python fast-path for performance. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:00:33 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 11:00:33 +0000 Subject: [issue27915] Use 'ascii' instead of 'us-ascii' to bypass lookup machinery In-Reply-To: <1472656129.69.0.589278825642.issue27915@psf.upfronthosting.co.za> Message-ID: <1472814033.92.0.238003843243.issue27915@psf.upfronthosting.co.za> STINNER Victor added the comment: It looks like the email module has a special usage of the "us-ascii" encoding name. It's not just an alias to "ascii". So I proposed a patch implementing the fast-path differently in the Python builtin codecs: see my issue #27938. The xml.etree module has special cases for the "us-ascii" encoding name, but not for "ascii". See the ElementTree.write() method. I proposed to also skip the XML declaration by default when "ascii" encoding is used: issue #27940. ---------- nosy: +haypo _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:04:35 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 11:04:35 +0000 Subject: [issue24648] Allocation of values array in split dicts should use small object allocator. In-Reply-To: <1437080324.24.0.647779902092.issue24648@psf.upfronthosting.co.za> Message-ID: <1472814275.32.0.831901838655.issue24648@psf.upfronthosting.co.za> Changes by STINNER Victor : ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:10:06 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 11:10:06 +0000 Subject: [issue27456] asyncio: set TCP_NODELAY flag by default In-Reply-To: <1467732468.65.0.201519937735.issue27456@psf.upfronthosting.co.za> Message-ID: <1472814606.56.0.779359858138.issue27456@psf.upfronthosting.co.za> Changes by STINNER Victor : ---------- title: TCP_NODELAY -> asyncio: set TCP_NODELAY flag by default _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:18:40 2016 From: report at bugs.python.org (=?utf-8?b?VmVkcmFuIMSMYcSNacSH?=) Date: Fri, 02 Sep 2016 11:18:40 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <1472815120.74.0.663961304181.issue23591@psf.upfronthosting.co.za> Vedran ?a?i? added the comment: > Nope. You are welcome to give more meaningful names to different combinations of powers of two. Yes, you're correct here, but what about output? Do all relevant bits have to be named separately? And will the output always talk about separate bits? We have talked about this. If I give meaningful name to 1, 3, 4 and 6, but not to 2, is it supported? And is the repr of 7 an implementation detail, or is it specified? One more question: in the docs, you say > otherwise, all members evaluate as :data:`True`. I would like you to reconsider the case of `.0` (.NONE in my terminology). Many other things in the interface (e.g. `in` operator) are modelled as if flags instance were just a container (set, in fact) of bits. In that case, empty set _should_ be false. Otherwise, this will be a weird exception to the usual container semantics. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:26:19 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 02 Sep 2016 11:26:19 +0000 Subject: [issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding In-Reply-To: <1472813879.44.0.998977479164.issue27940@psf.upfronthosting.co.za> Message-ID: <1472815578.99.0.818272171214.issue27940@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: > By the way, I'm surprised that the special encoding "unicode" relies on the *current* locale encoding when the XML declaration is requested. Why not alway susing UTF-8 for *unicode* instead of the locale encoding? Because it is usually outputs to sys.stdout or a file opened with default encoding. Agreed, the current locale encoding is not the best choice. It would be better to look at the encoding attribute of the file and fallback to utf-8 or ascii. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:37:42 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 02 Sep 2016 11:37:42 +0000 Subject: [issue27938] PyUnicode_AsEncodedString, PyUnicode_Decode: add fast-path for "us-ascii" encoding In-Reply-To: <1472811574.16.0.472581628747.issue27938@psf.upfronthosting.co.za> Message-ID: <1472816262.0.0.280428190646.issue27938@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: See also get_standard_encoding() in Python/codecs.c. I suppose it is faster. UTF-32 is rarely used as external encoding, but it is still used as internal encoding in some programming languages and libraries (e.g. wchar_t* in C and std::wstring in C++ on Linux). The codec itself is very fast. I would add fast path all utf encodings (except utf-7). ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:38:39 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 11:38:39 +0000 Subject: [issue16334] Faster unicode-escape and raw-unicode-escape codecs In-Reply-To: <1351291705.86.0.638624862326.issue16334@psf.upfronthosting.co.za> Message-ID: <1472816319.38.0.247037755651.issue16334@psf.upfronthosting.co.za> STINNER Victor added the comment: Unicode escape encodecs were modified by the issue #25353 to use the _PyBytesWriter API. Sadly, I didn't benchmark my change before pushing it :-/ Your patch basically reverts my change. > Py3.2 Py3.3 Py3.6 Py3.6+patch > 195 (+136%) 109 (+323%) 258 (+79%) 461 encode unicode-escape 'A'*10000 > 391 (+1310%) 333 (+1556%) 575 (+859%) 5514 encode raw-unicode-escape 'A'*10000 I'm surprised that the revert makes raw-unicode-escape encoder so much faster. Does it mean that the _PyBytesWriter API is so inefficient? The most efficient case for _PyBytesWriter is when you only call _PyBytesWriter_Alloc() and _PyBytesWriter_Finish() and the output string has exactly the allocated length. It should be the case when 'A'*10000 is encoded, no? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 07:45:24 2016 From: report at bugs.python.org (Stefan Krah) Date: Fri, 02 Sep 2016 11:45:24 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472816724.96.0.659959624905.issue22458@psf.upfronthosting.co.za> Stefan Krah added the comment: I've left comments on GitHub. [scoder] > As I said, where ever exact calculations are needed.. Even if the formatting comment is addressed, the main problem with this benchmark is that *both* fraction and decimal calculations are in fact exact here. You can check that by printing out the values for "t" in the loop like I suggested on GitHub. This is of course one of the main features of Decimal: If you're willing to take the penalty of a large precision, calculations can often be exact; similar to taking the penalty of potentially huge numerators and denominators in fractions. So this benchmark cannot be used to show the superiority of exact fractions. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 08:08:27 2016 From: report at bugs.python.org (Eric V. Smith) Date: Fri, 02 Sep 2016 12:08:27 +0000 Subject: [issue27921] f-strings: do not allow backslashes In-Reply-To: <1472687380.69.0.18258745604.issue27921@psf.upfronthosting.co.za> Message-ID: <1472818107.69.0.274831477389.issue27921@psf.upfronthosting.co.za> Eric V. Smith added the comment: > This looks a little ugly. True. My goal is to get the simplest possible thing working now, and then before beta 2 fix it so that backslashes again work in the text portions of an f-string. After that, I'll fix this particular piece of code (and the others, plus the tests that can be made to work). Here's an updated patch. I'm planning on committing it today. ---------- Added file: http://bugs.python.org/file44347/27921-1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 08:09:14 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 12:09:14 +0000 Subject: [issue16334] Faster unicode-escape and raw-unicode-escape codecs In-Reply-To: <1351291705.86.0.638624862326.issue16334@psf.upfronthosting.co.za> Message-ID: <1472818154.49.0.427751602863.issue16334@psf.upfronthosting.co.za> STINNER Victor added the comment: I rebased faster_unicode_escape_4.patch and made tiny changes: * Rename WRITECHAR macro to WRITE_ASCII_CHAR() * Add WRITE_CHAR() macro to avoid "goto writechar;" * Drop the "store" label: use WRITE_CHAR() macro instead, expect that getcode() only returns valid unicode characters (<= MAX_UNICODE) * For \UHHHHHHHH format: since MAX_UNICODE is 0x10ffff, hardcode the first two digits as 0, and add an assertion on MAX_UNICODE value * PEP 7: add {...} on if/else blocks ---------- Added file: http://bugs.python.org/file44348/faster_unicode_escape_5.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 08:20:35 2016 From: report at bugs.python.org (Eric V. Smith) Date: Fri, 02 Sep 2016 12:20:35 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472818835.18.0.292029719005.issue27934@psf.upfronthosting.co.za> Changes by Eric V. Smith : ---------- nosy: +eric.smith _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 1 16:53:00 2016 From: report at bugs.python.org (Steve Newcomb) Date: Thu, 01 Sep 2016 20:53:00 +0000 Subject: [issue27898] regexp performance degradation between 2.7.6 and 2.7.12 In-Reply-To: <1472575618.81.0.730978536893.issue27898@psf.upfronthosting.co.za> Message-ID: <25e15524-06ae-5739-bdb0-7dc7ae77371c@coolheads.com> Steve Newcomb added the comment: On 08/30/2016 12:46 PM, Raymond Hettinger wrote: > Raymond Hettinger added the comment: > > It would be helpful if you ... make a small set of regular expressions that demonstrate the performance regression. > Done. Attachments: test.py : Code that exercises re.sub() and outputs a profile report. test_output_2.7.6.txt : Output of test.py under Python 2.7.6. test_output_2.7.12.txt : Output of test.py under Python 2.7.12. p17.188.htm -- test data: public information from the U.S. Internal Revenue Service. Equivalent hardware was used in both cases. The outputs show that 2.7.12's re.sub() takes 1.2 times as long as 2.7.6's. It's a significant difference, but... ...it was not the dramatic degradation I expected to find in this exercise. Therefore I attempted to tease what I was looking for out of the profile stats I already uploaded to this site, made from actual production runs. My attempts are all found in an hg repository that can be downloaded from sftp://sftp at coolheads.com//files/py-re-perform-276-2712 using password bysIe20H . I do not feel the latter work took me where I wanted to go, and I think the reason is that, at least for purposes of our application, Python 2.7.12 has been so extensively refactored since Python 2.7.6. So it's an apples-to-oranges comparison, apparently. Still, the performance difference for re.sub() is quite dramatic , and re.sub() is the only comparable function whose performance dramatically worsened: in our application, 2.7.12's re.sub() takes 3.04 times as long as 2.7.6's. The good news, of course, is that by and large the performance of the other *comparable* functions largely improved, often dramatically. But at least in our application, it doesn't come close to making up for the degradation in re.sub(). My by-the-gut bottom line: somebody who really knows the re module should take a deep look at re.sub(). Why would re.sub(), unlike all others, take so much longer to run, while *every* other function in the re module get (often much) faster? It feels like there's a bug somewhere in re.sub(). Steve Newcomb ---------- Added file: http://bugs.python.org/file44335/test.py Added file: http://bugs.python.org/file44336/test_output_2.7.6.txt Added file: http://bugs.python.org/file44337/p17-188.htm Added file: http://bugs.python.org/file44338/test_output_2.7.12.txt _______________________________________ Python tracker _______________________________________ -------------- next part -------------- #!/usr/bin/env python2 import codecs, profile, os, re, sys hrefRE = re.compile( ''.join( [ r'href=', r'(?P["\'])', r'(?P', r'.*?', r')', r'(?=quote)', ], ), ) ####################################################### onePathSegmentMS = ''.join( [ r'(?P<_pathSeg>', r'(', r'/?', r'(', r'(?!', r'[ \t\r\n]+', r'$', r')', u'[^%s]' % ( re.escape( r'/?#')), r')+', r'|', r'/', r')', r')', ], ) onePathSegmentRE = re.compile( onePathSegmentMS) ####################################################### uriMS = r''.join( ( r'(?P', ## leading whitespace is OK and ignorable; see http://dev.w3.org/html5/spec-LC/urls.html r'[ \t\r\n]+', r')?', r'(', r'(?P', r'https?', r')', r':\/{0,2}', ## accounts for encountered error: only 0 or 1 slash instead of 2 r')?', r'(?P', r'(?P', r'(', r'(?P<_userinfo>', r'[^%s]+' % ( re.escape( r'@/[:?#')), r')', re.escape( '@'), r')?', r')', r'(?P', r'(?P', re.escape( r'['), r')?', r'(', r'(?P', r'(', r'[0-9]{1,3}%s' % ( re.escape( r'.')), r'){3}', r'[0-9]{1,3}', r')', r'|', r'(?P', r'(', r'[0-9A-Fa-f]{0,4}%s' % ( re.escape( ':')), r'){1,7}', r'[0-9A-Fa-f]{0,4}', r')', r'|', r'(?P', r'(', r'[^%s]+?' % ( re.escape( r']:/?#')), ## this may have dots r'\.', r')+', r'(?P', ## top-level domain, e.g. "com", "gov" etc. r'(', r'(?!', r'[ \t\r\n]+', r'$', r')', r'[^%s]' % ( re.escape( r']:/?#\.')), ## tld: no dots allowed r')+', r')', r')', r')', r'(?P', re.escape( r']'), r')?', r')', ## end of r'(?P', r'(', re.escape( r':'), r'(?P', r'[0-9]{1,5}', r')', r')?', r')', r')?', ## authority is optional; it could be a relative URL that starts with a path r'(?P', r'(', onePathSegmentMS, r')*', r')', r'(?P', re.escape( r'?',), r'(', r'(?P<_query>', r'(?!', r'[ \t\r\n]+', r'$', r')', r'[^%s]*' % ( re.escape( r'#')), r')', r')', r')?', r'(?P', r'(', re.escape( r'#',), r'(?P<_fragment>', r'(?!', r'[ \t\r\n]+', r'$', r')', r'.*', r')', r')?', r')', r'(?P', ## trailing whitespace is OK and ignorable; see http://dev.w3.org/html5/spec-LC/urls.html r'[ \t\r\n]+', r')?', ), ) uriRE = re.compile( ''.join( ( r'^', uriMS, r'$', ), ), re.IGNORECASE | re.DOTALL, ) ####################################################### def uriFunc( MO): z = MO.groupdict() z[ 'scheme'] ####################################################### def hrefFunc( MO): re.sub( uriRE, uriFunc, MO.group( 'url') ) ####################################################### def test(): for iteration in range( 10000): re.sub( hrefRE, hrefFunc, text, ) ####################################################### if __name__ == '__main__': textFO = codecs.open( 'p17-188.htm', 'r', 'utf-8') text = textFO.read() textFO.close() import cProfile cProfile.run( 'test()', '/tmp/profile-%d' % ( os.getpid())) import pstats p = pstats.Stats( '/tmp/profile-%d' % ( os.getpid())) print '\nprofile for Python version %s\n%s\n%s' % ( '.'.join( map( str, sys.version_info, ), ), ' '.join( os.uname()).strip(), open( '/etc/issue', 'r').read().strip(), ) # p.sort_stats( 'cumulative').print_stats( 10) p.sort_stats('time').print_stats(10) -------------- next part -------------- profile for Python version 2.7.6.final.0 Linux slk 3.16.0-77-generic #99~14.04.1-Ubuntu SMP Tue Jun 28 19:17:10 UTC 2016 x86_64 Ubuntu 14.04.5 LTS \n \l Thu Sep 1 15:43:34 2016 /tmp/profile-23959 50004 function calls in 2.533 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 10000 2.468 0.000 2.468 0.000 {method 'sub' of '_sre.SRE_Pattern' objects} 10000 0.023 0.000 0.034 0.000 /usr/lib/python2.7/re.py:226(_compile) 10000 0.021 0.000 2.523 0.000 /usr/lib/python2.7/re.py:144(sub) 1 0.010 0.010 2.533 2.533 ./test.py:174(test) 10000 0.006 0.000 0.006 0.000 {method 'get' of 'dict' objects} 10000 0.006 0.000 0.006 0.000 {isinstance} 1 0.000 0.000 0.000 0.000 {range} 1 0.000 0.000 2.533 2.533 :1() 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} -------------- next part -------------- Publication 17 - Your Federal Income Tax (For Individuals) - Other Credits
Publication 17
taxmap/pub17/p17-188.htm#en_us_publink1000174891

Chapter 38
Other Credits(p243)


What's New(p243)


EIC
At the time this publication was prepared for printing, Congress was considering legislation that could affect many of the credits discussed in this chapter. To see if the legislation was enacted, go to www.irs.gov/pub17.
taxmap/pub17/p17-188.htm#en_us_publink1000272991
Adoption credit.(p243)
The maximum adoption credit is $13,400 for 2015. See Adoption Credit.
taxmap/pub17/p17-188.htm#en_us_publink1000262520
Excess withholding of social security and railroad retirement tax.(p243)
Social security tax and tier 1 railroad retirement (RRTA) tax were both withheld during 2015 at a rate of 6.2% of wages up to $118,500. If you worked for more than one employer and had too much social security or RRTA tax withheld during 2015, you may be entitled to a credit for the excess withholding. See Credit for Excess Social Security Tax or Railroad Retirement Tax Withheld.
taxmap/pub17/p17-188.htm#en_us_publink100036050
Alternative fuel vehicle refueling credit.(p243)
The credit for alternative fuel vehicle refueling property has expired. You can't claim this credit for alternative fuel vehicle refueling property placed in service after 2014. However, a partner in a fiscal year partnership or shareholder of a fiscal year S corporation may receive an alternative fuel vehicle refueling property credit that must be reported on a 2015 return.
taxmap/pub17/p17-188.htm#en_us_publink100036051
Alternative motor vehicle credit.(p243)
The alternative motor vehicle credit has expired for vehicles purchased after 2014. However, if you purchased the vehicle before 2015, but placed it in service during 2015, you may still be able to claim the credit for 2015. Don't report vehicles purchased after 2014 on Form 8910 unless the credit is extended.
taxmap/pub17/p17-188.htm#en_us_publink100036052
Residential energy credit.(p243)
The nonbusiness energy property credit has expired. You can't claim this credit for nonbusiness energy property placed in service after 2014. You may, however, still be able to claim the residential energy efficient property credit.
taxmap/pub17/p17-188.htm#en_us_publink100036053
Plug-in electric drive motor vehicle credit.(p243)
The credit for qualified two- or three-wheeled plug-in electric vehicles acquired after 2013 has expired.
taxmap/pub17/p17-188.htm#en_us_publink100036054
Health coverage tax credit.(p243)
The health coverage tax credit, which expired at the end of 2013 has been reinstated. For 2015, if you were an eligible trade adjustment assistance (TAA) recipient, alternative TAA recipient, reemployment TAA recipient, Pension Benefit Guarantee pension payee, or qualifying family member, you may be able to take the HCTC for health insurance coverage purchased through a Health Insurance Marketplace. Eligibility for the HCTC is generally the same as in 2013 with the following changes.
  • The HCTC is now an election. Once you make the election to take the HCTC for a month, the election will apply to all subsequent months during your tax year unless you no longer qualify to take the HCTC. See How to take the credit under Health Coverage Tax Credit, below.
  • For 2015, you can take the HCTC for a qualified health plan purchased through a Health Insurance Marketplace. This insurance coverage also qualifies for the premium tax credit taken on Form 8962, Premium Tax Credit (PTC). You can’t take both the HCTC and PTC for the same qualified health plan in the same coverage month. For information on qualified health plans purchased through a Health Insurance Marketplace and the premium tax credit, see the Instructions for Form 8962.
taxmap/pub17/p17-188.htm#en_us_publink1000177264
Several other credits are discussed in other chapters in this publication.
taxmap/pub17/p17-188.htm#en_us_publink1000174903

Nonrefundable credits.(p243)

rule
The first part of this chapter, Nonrefundable Credits, covers ten credits that you subtract from your tax. These credits may reduce your tax to zero. If these credits are more than your tax, the excess isn't refunded to you.
taxmap/pub17/p17-188.htm#en_us_publink1000174904

Refundable credits.(p243)

rule
The second part of this chapter, Refundable Credits, covers three credits that are treated as payments and are refundable to you. These credits are added to the federal income tax withheld and any estimated tax payments you made. If this total is more than your total tax, the excess may be refunded to you.

taxmap/pub17/p17-188.htm#TXMP0b514dd7

Useful items

You may want to see:


Publication
 502 Medical and Dental Expenses
 514 Foreign Tax Credit for
Individuals

 530 Tax Information for Homeowners
 590-A Contributions to Individual Retirement Arrangements (IRAs)
 590-B Distributions from Individual Retirement Arrangements (IRAs)
Form (and Instructions)
 1116: Foreign Tax Credit
 2439: Notice to Shareholder of Undistributed Long-Term Capital Gains
 5695: Residential Energy Credit
 8396: Mortgage Interest Credit
 8801: Credit For Prior Year Minimum Tax — Individuals, Estates, and Trusts
 8828: Recapture of Federal Mortgage Subsidy
 8839: Qualified Adoption Expenses
 8880: Credit for Qualified Retirement Savings Contributions
 8885: Health Coverage Tax Credit
 8910: Alternative Motor Vehicle Credit
 8911: Alternative Fuel Vehicle Refueling Property Credit
 8912: Credit to Holders of Tax Credit Bonds
 8936: Qualified Plug-in Electric Drive Motor Vehicle Credit
taxmap/pub17/p17-188.htm#en_us_publink1000174999

Nonrefundable Credits(p243)

rule
The credits discussed in this part of the chapter can reduce your tax. However, if the total of these credits is more than your tax, the excess isn't refunded to you.
taxmap/pub17/p17-188.htm#en_us_publink1000272996

Adoption Credit(p243)

rule
You may be able to take a tax credit of up to $13,400 for qualified expenses paid to adopt an eligible child. The credit may be allowed for the adoption of a child with special needs even if you don't have any qualified expenses.
If your modified adjusted gross income (AGI) is more than $201,010, your credit is reduced. If your modified AGI is $241,010 or more, you can't take the credit.
taxmap/pub17/p17-188.htm#en_us_publink1000272997

Qualified adoption expenses.(p243)

rule
Qualified adoption expenses are reasonable and necessary expenses directly related to, and whose principal purpose is for, the legal adoption of an eligible child. These expenses include:
  • Adoption fees,
  • Court costs,
  • Attorney fees,
  • Travel expenses (including amounts spent for meals and lodging) while away from home, and
  • Re-adoption expenses to adopt a foreign child.
taxmap/pub17/p17-188.htm#en_us_publink1000272998
Nonqualified expenses.(p244)
Qualified adoption expenses don't include expenses:
  • That violate state or federal law,
  • For carrying out any surrogate parenting arrangement,
  • For the adoption of your spouse's child,
  • For which you received funds under any federal, state, or local program,
  • Allowed as a credit or deduction under any other federal income tax rule, or
  • Paid or reimbursed by your employer or any other person or organization.
taxmap/pub17/p17-188.htm#en_us_publink1000272999

Eligible child.(p244)

rule
The term "eligible child" means any individual:
  • Under 18 years old, or
  • Physically or mentally incapable of caring for himself or herself.
taxmap/pub17/p17-188.htm#en_us_publink1000273000
Child with special needs.(p244)
An eligible child is a child with special needs if all three of the following apply.
  1. The child was a citizen or resident of the United States (including U.S. possessions) at the time the adoption process began.
  2. A state (including the District of Columbia) has determined that the child can't or shouldn't be returned to his or her parents' home.
  3. The state has determined that the child won't be adopted unless assistance is provided to the adoptive parents. Factors used by states to make this determination include:
    1. The child's ethnic background,
    2. The child's age,
    3. Whether the child is a member of a minority or sibling group, and
    4. Whether the child has a medical condition or a physical, mental, or emotional handicap.
taxmap/pub17/p17-188.htm#en_us_publink1000273001

When to take the credit.(p244)

rule
Generally, until the adoption becomes final, you take the credit in the year after your qualified expenses were paid or incurred. If the adoption becomes final, you take the credit in the year your expenses were paid or incurred. See the Instructions for Form 8839 for more specific information on when to take the credit.
taxmap/pub17/p17-188.htm#en_us_publink1000273002
Foreign child.(p244)
If the child isn't a U.S. citizen or resident at the time the adoption process began, you can't take the credit unless the adoption becomes final. You treat all adoption expenses paid or incurred in years before the adoption becomes final as paid or incurred in the year it becomes final.
taxmap/pub17/p17-188.htm#en_us_publink1000273007

How to take the credit.(p244)

rule
Figure your 2015 nonrefundable credit and any carryforward to 2016 on Form 8839 and attach it to your Form 1040. Include the credit in your total for Form 1040, line 54. Check box c and enter "8839" on the line next to that box.
taxmap/pub17/p17-188.htm#en_us_publink1000273008

More information.(p244)

rule
For more information, see the Instructions for Form 8839.
taxmap/pub17/p17-188.htm#en_us_publink1000174914

Alternative Motor Vehicle Credit(p244)

rule
An alternative motor vehicle is a vehicle with at least four wheels that qualifies as a qualified fuel cell vehicle. You may be able to take this credit if you are the owner of a qualified fuel cell vehicle and placed it in service in 2015.
EIC
The alternative motor vehicle credit has expired for vehicles purchased after 2014. However, if you purchased the vehicle before 2015, but placed it in service during 2015, you may still be able to claim the credit for 2015. At the time these instructions went to print, Congress had not enacted legislation on expired provisions. To find out if legislation has been enacted, go to www.irs.gov/pub17.
taxmap/pub17/p17-188.htm#en_us_publink100036057

Qualified fuel cell vehicle.(p244)

rule
A qualified fuel cell vehicle is a new vehicle propelled by power derived from one or more cells that convert chemical energy directly into electricity by combining oxygen with hydrogen fuel, and that meets certain additional requirements.
taxmap/pub17/p17-188.htm#en_us_publink1000174916

Amount of credit.(p244)

rule
Generally, you can rely on the manufacturer's certification to the IRS that a specific make, model, and model year vehicle qualifies for the credit and the amount of the credit for which it qualifies. In the case of a foreign manufacturer, you generally can rely on its domestic distributor's certification to the IRS.
Ordinarily the amount of the credit is 100% of the manufacturer's (or domestic distributor's) certification to the IRS of the maximum credit allowable.
taxmap/pub17/p17-188.htm#en_us_publink1000174921

How to take the credit.(p244)

rule
To take the credit, you must complete Form 8910 and attach it to your Form 1040. Include the credit in your total for Form 1040, line 54. Check box c and enter "8910" on the line next to that box.
taxmap/pub17/p17-188.htm#en_us_publink1000174922

More information.(p244)

rule
For more information on the credit, see the Instructions for Form 8910.
taxmap/pub17/p17-188.htm#en_us_publink1000174923

Alternative Fuel Vehicle Refueling Property Credit(p244)

rule
The credit for alternative fuel vehicle refueling property has expired. You can't claim this credit for alternative fuel vehicle refueling property placed in service after 2014. However, a partner in a fiscal year partnership or shareholder of a fiscal year S corporation may receive an alternative fuel vehicle refueling property credit that must be reported on a 2015 return.
taxmap/pub17/p17-188.htm#en_us_publink1000174924

Qualified alternative fuel vehicle refueling property.(p244)

rule
Qualified alternative fuel vehicle refueling property is any property (other than a building or its structural components) used to store or dispense alternative fuel into the fuel tank of a motor vehicle propelled by the fuel, but only if the storage or dispensing is at the point where the fuel is delivered into that tank.
An alternative fuel is a fuel at least 85% of the volume of which consists of hydrogen.
EIC
The credit has expired for alternative fuel vehicle refueling property placed in service after 2014. At the time this publication went to print, Congress had not enacted legislation on expired provisions. To find out if legislation has been enacted, go to www.irs.gov/pub17.
taxmap/pub17/p17-188.htm#en_us_publink1000174926

Amount of the credit.(p244)

rule
For business use property, the credit is generally the smaller of 30% of the property's cost or $30,000.
taxmap/pub17/p17-188.htm#en_us_publink1000174927

How to take the credit.(p244)

rule
Recipients of these credits that are partnerships or S corporations must report these amounts on line 8 of Form 8911. See Form 8911 and its instructions for more information.
taxmap/pub17/p17-188.htm#en_us_publink1000174928

More information.(p244)

rule
For more information on the credit, see the Instructions for Form 8911.
taxmap/pub17/p17-188.htm#en_us_publink1000174929

Credit to Holders of Tax Credit Bonds(p244)

rule
Tax credit bonds are bonds in which the holder receives a tax credit in lieu of some or all of the interest on the bond.
You may be able to take a credit if you are a holder of one of the following bonds.
  • Clean renewable energy bonds (issued before 2010).
  • New clean renewable energy bonds.
  • Qualified energy conservation bonds.
  • Qualified school construction bonds.
  • Qualified zone academy bonds.
  • Build America bonds.
In some instances, an issuer may elect to receive a credit for interest paid on the bond. If the issuer makes this election, you can't also claim a credit.
taxmap/pub17/p17-188.htm#en_us_publink1000174930

Interest income.(p244)

rule
The amount of any tax credit allowed (figured before applying tax liability limits) must be included as interest income on your tax return.
taxmap/pub17/p17-188.htm#en_us_publink1000174931

How to take the credit.(p244)

rule
Complete Form 8912 and attach it to your Form 1040. Include the credit in your total for Form 1040, line 54. Check box c and enter "8912" on the line next to that box.
taxmap/pub17/p17-188.htm#en_us_publink1000174932

More information.(p244)

rule
For more information, see the Instructions for Form 8912.
taxmap/pub17/p17-188.htm#en_us_publink1000174933

Foreign Tax Credit(p244)

rule
You generally can choose to take income taxes you paid or accrued during the year to a foreign country or U.S. possession as a credit against your U.S. income tax. Or, you can deduct them as an itemized deduction (see chapter 22).
You can't take a credit (or deduction) for foreign income taxes paid on income that you exclude from U.S. tax under any of the following.
  1. Foreign earned income exclusion.
  2. Foreign housing exclusion.
  3. Income from Puerto Rico exempt from U.S. tax.
  4. Possession exclusion.
taxmap/pub17/p17-188.htm#en_us_publink1000174935

Limit on the credit.(p245)

rule
Unless you can elect not to file Form 1116 (see Exception), your foreign tax credit can't be more than your U.S. tax liability (line 47), multiplied by a fraction. The numerator of the fraction is your taxable income from sources outside the United States. The denominator is your total taxable income from U.S. and foreign sources. See Pub. 514 for more information.
taxmap/pub17/p17-188.htm#en_us_publink1000174937

How to take the credit.(p245)

rule
Complete Form 1116 and attach it to your Form 1040. Enter the credit on Form 1040, line 48.
taxmap/pub17/p17-188.htm#en_us_publink1000174938
Exception.(p245)
You don't have to complete Form 1116 to take the credit if all of the following apply.
  1. All of your gross foreign source income was from interest and dividends and all of that income and the foreign tax paid on it were reported to you on Form 1099-INT, Form 1099-DIV, or Schedule K-1 (or substitute statement).
  2. You held the stock or bonds on which the dividends and interest were paid for at least 16 days and weren't obligated to pay these amounts to someone else.
  3. You aren't filing Form 4563 or excluding income from sources within Puerto Rico.
  4. The total of your foreign taxes wasn't more than $300 (not more than $600 if married filing jointly).
  5. All of your foreign taxes were:
    1. Legally owed and not eligible for a refund or reduced tax rate under a tax treaty, and
    2. Paid to countries that are recognized by the United States and don't support terrorism.
taxmap/pub17/p17-188.htm#en_us_publink1000260891

More information.(p245)

rule
For more information on the credit and these requirements, see the Instructions for Form 1116.
taxmap/pub17/p17-188.htm#en_us_publink1000174939

Mortgage Interest Credit(p245)

rule
The mortgage interest credit is intended to help lower-income individuals own a home. If you qualify, you can take the credit each year for part of the home mortgage interest you pay.
taxmap/pub17/p17-188.htm#en_us_publink1000174940

Who qualifies.(p245)

rule
You may be eligible for the credit if you were issued a qualified Mortgage Credit Certificate (MCC) from your state or local government. Generally, an MCC is issued only in connection with a new mortgage for the purchase of your main home.
taxmap/pub17/p17-188.htm#en_us_publink1000174941

Amount of credit.(p245)

rule
Figure your credit on Form 8396. If your mortgage loan amount is equal to (or smaller than) the certified indebtedness (loan) amount shown on your MCC, enter on Form 8396, line 1, all the interest you paid on your mortgage during the year.
If your mortgage loan amount is larger than the certified indebtedness amount shown on your MCC, you can figure the credit on only part of the interest you paid. To find the amount to enter on line 1, multiply the total interest you paid during the year on your mortgage by the following fraction.
 Certified indebtedness amount on your MCC 
 Original amount of your mortgage 
taxmap/pub17/p17-188.htm#en_us_publink1000174943

Limit based on credit rate.(p245)

rule
If the certificate credit rate is more than 20%, the credit you are allowed can't be more than $2,000. If two or more persons (other than a married couple filing a joint return) hold an interest in the home to which the MCC relates, this $2,000 limit must be divided based on the interest held by each person. See Pub. 530 for more information.
taxmap/pub17/p17-188.htm#en_us_publink1000174944

Carryforward.(p245)

rule
Your credit (after applying the limit based on the credit rate) is also subject to a limit based on your tax that is figured using Form 8396. If your allowable credit is reduced because of this tax liability limit, you can carry forward the unused portion of the credit to the next 3 years or until used, whichever comes first.
If you are subject to the $2,000 limit because your certificate credit rate is more than 20%, you can't carry forward any amount more than $2,000 (or your share of the $2,000 if you must divide the credit).
taxmap/pub17/p17-188.htm#en_us_publink1000174945

How to take the credit.(p245)

rule
Figure your 2015 credit and any carryforward to 2016 on Form 8396, and attach it to your Form 1040. Be sure to include any credit carryforward from 2012, 2013, and 2014.
Include the credit in your total for Form 1040, line 54. Check box c and enter "8396" on the line next to that box.
taxmap/pub17/p17-188.htm#en_us_publink1000174946

Reduced home mortgage interest deduction.(p245)

rule
If you itemize your deductions on Schedule A (Form 1040), you must reduce your home mortgage interest deduction by the amount of the mortgage interest credit shown on Form 8396, line 3. You must do this even if part of that amount is to be carried forward to 2016. For more information about the home mortgage interest deduction, see chapter 23.
taxmap/pub17/p17-188.htm#en_us_publink1000174948

Recapture of federal mortgage subsidy.(p245)

rule
If you received an MCC with your mortgage loan, you may have to recapture (pay back) all or part of the benefit you received from that program. The recapture may be required if you sell or dispose of your home at a gain during the first 9 years after the date you closed your mortgage loan. See the Instructions for Form 8828 and chapter 15 for more information.
taxmap/pub17/p17-188.htm#en_us_publink1000260892

More information.(p245)

rule
For more information on the credit, see the Instructions for Form 8396.
taxmap/pub17/p17-188.htm#en_us_publink1000174949

Nonrefundable Credit for Prior Year Minimum Tax(p245)

rule
The tax laws give special treatment to some kinds of income and allow special deductions and credits for some kinds of expenses. If you benefit from these laws, you may have to pay at least a minimum amount of tax in addition to any other tax on these items. This is called the alternative minimum tax.
The special treatment of some items of income and expenses only allows you to postpone paying tax until a later year. If in prior years you paid alternative minimum tax because of these tax postponement items, you may be able to take a credit for prior year minimum tax against your current year's regular tax.
You may be able to take a credit against your regular tax if for 2014 you had:
  • An alternative minimum tax liability and adjustments or preferences other than exclusion items,
  • A minimum tax credit that you are carrying forward to 2015, or
  • An unallowed qualified electric vehicle credit.
taxmap/pub17/p17-188.htm#en_us_publink1000174952

How to take the credit.(p245)

rule
Figure your 2015 nonrefundable credit (if any), and any carryforward to 2016 on Form 8801, and attach it to your Form 1040. Include the credit in your total for Form 1040, line 54, and check box b. You can carry forward any unused credit for prior year minimum tax to later years until it is completely used.
taxmap/pub17/p17-188.htm#en_us_publink1000174953

More information.(p245)

rule
For more information on the credit, see the Instructions for Form 8801.
taxmap/pub17/p17-188.htm#en_us_publink1000210768

Plug-in Electric Drive Motor Vehicle Credit(p245)

rule
You may be able to take this credit if you placed in service for business or personal use a qualified plug-in electric drive motor vehicle in 2015 and you meet some other requirements.
taxmap/pub17/p17-188.htm#en_us_publink1000296807

Qualified plug-in electric drive motor vehicle.(p245)

rule
This is a new vehicle with at least four wheels that:
  • Is propelled to a significant extent by an electric motor that draws electricity from a battery that has a capacity of not less than 4 kilowatt hours and is capable of being recharged from an external source of electricity, and
  • Has a gross vehicle weight of less than 14,000 pounds.
taxmap/pub17/p17-188.htm#en_us_publink1000296897

Certification and other requirements. (p245)

rule
Generally, you can rely on the manufacturer's (or, in the case of a foreign manufacturer, its domestic distributor's) certification to the IRS that a specific make, model, and model year vehicle qualifies for the credit and, if applicable, the amount of the credit for which it qualifies. However, if the IRS publishes an announcement that the certification for any specific make, model, and model year vehicle has been withdrawn, you can't rely on the certification for such a vehicle purchased after the date of publication of the withdrawal announcement.
The following requirements must also be met to qualify for the credit.
  • You are the owner of the vehicle. If the vehicle is leased, only the lessor, and not the lessee, is entitled to the credit.
  • You placed the vehicle in service during 2015.
  • The vehicle is manufactured primarily for use on public streets, roads, and highways.
  • The original use of the vehicle began with you.
  • You acquired the vehicle for your use or to lease to others, and not for resale.
  • You use the vehicle primarily in the United States.
taxmap/pub17/p17-188.htm#en_us_publink1000210771

How to take the credit.(p246)

rule
To take the credit, you must complete Form 8936 and attach it to your Form 1040. Include the credit in your total for Form 1040, line 54. Check box c and enter "8936" on the line next to that box.
taxmap/pub17/p17-188.htm#en_us_publink1000260893

More information.(p246)

rule
For more information on the credit, see the Instructions for Form 8936.
taxmap/pub17/p17-188.htm#en_us_publink1000174954

Residential Energy Credit(p246)

rule
You may be able to take the residential energy efficient property credit if you made energy saving improvements to your home located in the United States in 2015.
If you are a member of a condominium management association for a condominium you own or a tenant-stockholder in a cooperative housing corporation, you are treated as having paid your proportionate share of any costs of the association or corporation.
taxmap/pub17/p17-188.htm#en_us_publink1000209301

Residential energy efficient property credit.(p246)

rule
You may be able to take a credit of 30% of your costs of qualified solar electric property, solar water heating property, fuel cell property, small wind energy property, and geothermal heat pump property. The credit amount for costs paid for qualified fuel cell property is limited to $500 for each one-half kilowatt of capacity of the property.
EIC
At the time this publication was prepared for printing, Congress was considering legislation that would extend the nonbusiness energy property credit, which expired at the end of 2014. To see if the legislation was enacted, go to www.irs.gov/pub17.
taxmap/pub17/p17-188.htm#en_us_publink1000174957

Basis reduction.(p246)

rule
You must reduce the basis of your home by the amount of any credit allowed.
taxmap/pub17/p17-188.htm#en_us_publink1000174958

How to take the credit.(p246)

rule
Complete Form 5695 and attach it to your Form 1040. Enter the credit on Form 1040, line 53.
taxmap/pub17/p17-188.htm#en_us_publink1000174959

More information.(p246)

rule
For more information on the credit, see the Instructions for Form 5695.
taxmap/pub17/p17-188.htm#en_us_publink1000174960

Retirement Savings Contributions Credit (Saver's Credit)(p246)

rule
You may be able to take this credit if you, or your spouse if filing jointly, made:
  • Contributions (other than rollover contributions) to a traditional or Roth IRA,
  • Elective deferrals to a 401(k) or 403(b) plan (including designated Roth contributions) or to a governmental 457, SEP, or SIMPLE plan,
  • Voluntary employee contributions to a qualified retirement plan (including the federal Thrift Savings Plan), or
  • Contributions to a 501(c)(18)(D) plan.
However, you can't take the credit if either of the following applies.
  1. The amount on Form 1040, line 38, or Form 1040A, line 22, is more than $30,500 ($45,750 if head of household; $61,000 if married filing jointly).
  2. The person(s) who made the qualified contribution or elective deferral: (a) was born after January 1, 1998, (b) is claimed as a dependent on someone else's 2015 tax return, or (c) was a student (defined next).
taxmap/pub17/p17-188.htm#en_us_publink1000174961

Student.(p246)

rule
You were a student if during any part of five calendar months of 2015 you:
  • Were enrolled as a full-time student at a school, or
  • Took a full-time, on-farm training course given by a school or a state, county, or local government agency.
taxmap/pub17/p17-188.htm#en_us_publink1000174962
School.(p246)
A school includes a technical, trade, or mechanical school. It doesn't include an on-the-job training course, correspondence school, or school offering courses only through the Internet.
taxmap/pub17/p17-188.htm#en_us_publink1000174963

How to take the credit.(p246)

rule
Figure the credit on Form 8880. Enter the credit on your Form 1040, line 51, or your Form 1040A, line 34, and attach Form 8880 to your return.
taxmap/pub17/p17-188.htm#en_us_publink1000260895

More information.(p246)

rule
For more information on the credit, see the Instructions for Form 8880.
-------------- next part -------------- profile for Python version 2.7.12.final.0 Linux babs 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 Ubuntu 16.04.1 LTS \n \l Thu Sep 1 15:45:41 2016 /tmp/profile-18760 40004 function calls in 2.996 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 10000 2.964 0.000 2.964 0.000 {method 'sub' of '_sre.SRE_Pattern' objects} 10000 0.016 0.000 0.017 0.000 /usr/lib/python2.7/re.py:230(_compile) 10000 0.011 0.000 2.992 0.000 /usr/lib/python2.7/re.py:148(sub) 1 0.005 0.005 2.996 2.996 ./test.py:174(test) 10000 0.001 0.000 0.001 0.000 {isinstance} 1 0.000 0.000 0.000 0.000 {range} 1 0.000 0.000 2.996 2.996 :1() 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} From report at bugs.python.org Fri Sep 2 10:01:47 2016 From: report at bugs.python.org (Eddie James) Date: Fri, 02 Sep 2016 14:01:47 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472824907.68.0.995590114959.issue27934@psf.upfronthosting.co.za> Eddie James added the comment: Understood on 2.7, I wasn't aware it would cause any issues. Dbus.Double is not a subclass of float unfortunately. Problem is that all Dbus types seem to have a custom tp_repr method that returns that strange formatting I mentioned. So repr won't be the same as str, in any version of python. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:27:36 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 02 Sep 2016 14:27:36 +0000 Subject: [issue16334] Faster unicode-escape and raw-unicode-escape codecs In-Reply-To: <1472816319.38.0.247037755651.issue16334@psf.upfronthosting.co.za> Message-ID: <3036311.Mms2NO2dIf@xarax> Serhiy Storchaka added the comment: > Unicode escape encodecs were modified by the issue #25353 to use the > _PyBytesWriter API. Sadly, I didn't benchmark my change before pushing it > :-/ You can benchmark it now by checking out revisions with your patch and just before. But AFAIK the performance was not changed since 3.3 and the effect of your patch is the difference between columns 3.3 and 3.6 (very good). I used scripts from https://bitbucket.org/storchaka/cpython-stuff/src/default/ bench/ . > Your patch basically reverts my change. > > > Py3.2 Py3.3 Py3.6 Py3.6+patch > > 195 (+136%) 109 (+323%) 258 (+79%) 461 encode unicode-escape > > 'A'*10000 391 (+1310%) 333 (+1556%) 575 (+859%) 5514 encode > > raw-unicode-escape 'A'*10000 > I'm surprised that the revert makes raw-unicode-escape encoder so much > faster. Does it mean that the _PyBytesWriter API is so inefficient? I don't remember all details, but it seems that after applying all optimizations _PyBytesWriter became just not needed (unlike to _PyUnicodeWriter that is used for widening a buffer). The awesome difference in encoding for ascii-only data is not related to using _PyBytesWriter. It is caused by reordering checks in the inner loop. > * Rename WRITECHAR macro to WRITE_ASCII_CHAR() This is not correct name. This macro is used for writing non-ascii characters too. > * Add WRITE_CHAR() macro to avoid "goto writechar;" > * Drop the "store" label: use WRITE_CHAR() macro instead, Did you benchmark this change? I afraid that this inflates execution code size and can have negative impact on the performance. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:33:44 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 14:33:44 +0000 Subject: [issue16334] Faster unicode-escape and raw-unicode-escape codecs In-Reply-To: <1351291705.86.0.638624862326.issue16334@psf.upfronthosting.co.za> Message-ID: <1472826824.75.0.962136403255.issue16334@psf.upfronthosting.co.za> STINNER Victor added the comment: > Did you benchmark this change? I afraid that this inflates execution code size and can have negative impact on the performance. I consider that readability (maintainability) matters more than such micro optimization. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:40:01 2016 From: report at bugs.python.org (R. David Murray) Date: Fri, 02 Sep 2016 14:40:01 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472827201.0.0.313293597738.issue27934@psf.upfronthosting.co.za> R. David Murray added the comment: Nothing that can/should be done on the stdlib side, then. ---------- nosy: +r.david.murray resolution: -> third party stage: -> resolved status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:40:33 2016 From: report at bugs.python.org (Ethan Furman) Date: Fri, 02 Sep 2016 14:40:33 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <1472827233.45.0.0516654827184.issue23591@psf.upfronthosting.co.za> Ethan Furman added the comment: > Yes, you're correct here, but what about output? Do all relevant bits have > to be named separately? No. > And will the output always talk about separate > bits? No. > We have talked about this. Indeed. Here's my previous reply. ;) >> The algorithm is simple: start with the biggest Flag and mask off >> matching bits until all bits are are matched. When I said "biggest flag" I meant the flag with the highest value (so a flag of 5 would get matched before a flag of four). >> If any unmatched bits remain an error is raised. This part is specifically for Flag; IntFlag will just show the values of any unmatched bits. > If I give meaningful name to 1, 3, 4 and > 6, but not to 2, is it supported? Depends. Not having 2 named has different consequences for Flag vs IntFlag (although neither is an error): - Flag: no combination of flags will ever have the 2 bit set - IntFlag: '2' will show in the name portion if the 2 bit is set > And is the repr of 7 an implementation detail, or is it specified? I should specify it in the docs, thanks. > One more question: in the docs, you say >> >> otherwise, all members evaluate as :data:`True`. > >I would like you to reconsider the case of `.0` (.NONE in my > terminology). Many other things in the interface (e.g. `in` operator) > are modelled as if flags instance were just a container (set, in fact) > of bits. In that case, empty set _should_ be false. Otherwise, this will > be a weird exception to the usual container semantics. Very good point. Unless I can think of a good reason not to, I'll make that change in the next couple days. Thanks. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:44:04 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 14:44:04 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472827444.67.0.205056055676.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: > Dbus.Double is not a subclass of float unfortunately. Okay, now I'm *really* confused. :-) If it's not a subclass of `float`, then how do you end up in the `floatstr` code? Every path to that code that I can see in the source is via an `isinstance(, float`) check. I don't know dbus at all, but I just tried installing it under Macports (on OS X 10.9). Here's the package description, so you can tell me whether I'm actually installing the right thing, or something totally unrelated: dbus-python35 @1.2.0_2 (devel, python) Python bindings for the dbus message bus system. Once I've done that, I get the following behaviour in Python: Python 3.5.2 (default, Aug 16 2016, 08:43:53) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import dbus >>> dbus.Double >>> dbus.Double.__mro__ (, , , ) So it looks as though at least for this version of dbus, we do have a subclass of `float`. Looking at an instance, I see the following: >>> x = dbus.Double(4.3) >>> isinstance(x, float) True >>> repr(x) 'dbus.Double(4.3)' >>> str(x) '4.3' >>> float.__repr__(x) '4.3' >>> float.__str__(x) '4.3' >>> import json >>> json.dumps(x) '4.3' So I'm still struggling to see what difference swapping out float.__repr__ for float.__str__ would make. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:46:50 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 14:46:50 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472827610.34.0.189724470983.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: > Nothing that can/should be done on the stdlib side, then. I think there's nothing to do for 3.x: as far as I can tell, everything should be working exactly as desired there. For 2.7, we may want to consider processing float instances using `float.__repr__` instead of plain old `repr`. I believe that would fix the OP's problem, and also bring the 2.7 behaviour more in line with the 3.x behaviour. It's a backwards incompatible behaviour change, but probably not a particularly disruptive one. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:48:44 2016 From: report at bugs.python.org (Stefan Behnel) Date: Fri, 02 Sep 2016 14:48:44 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472827724.05.0.863427733517.issue22458@psf.upfronthosting.co.za> Stefan Behnel added the comment: > So this benchmark cannot be used to show the superiority of exact fractions. I don't see how a benchmark would be a way to show that. It's certainly not the goal of this benchmark to show that one is computationally better than the other. But if a benchmark for one part of Python allows a direct, reasonable speed comparison with another, why would you object to make use of that? > is the purpose of this benchmark to show that fractions are slow and generate interest in changing the situation? There have been a couple of attempts to make them faster already. The speed improvements in Py3.5 and 3.6 directly result from those changes. Thus, making these improvements visible and comparable across Python versions and different implementations is one of the goals of this benchmark. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:55:02 2016 From: report at bugs.python.org (R. David Murray) Date: Fri, 02 Sep 2016 14:55:02 +0000 Subject: [issue27931] Email parse IndexError <""@wiarcom.com> In-Reply-To: <1472743779.07.0.918992764498.issue27931@psf.upfronthosting.co.za> Message-ID: <1472828102.75.0.70737179984.issue27931@psf.upfronthosting.co.za> R. David Murray added the comment: You are correct, it is technically a valid angleaddr. I'll review this next week, the patch looks good (thanks) but I need to double check a couple things before I commit. ---------- assignee: -> r.david.murray stage: needs patch -> commit review _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 10:56:29 2016 From: report at bugs.python.org (Eddie James) Date: Fri, 02 Sep 2016 14:56:29 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472828189.91.0.0469973142334.issue27934@psf.upfronthosting.co.za> Eddie James added the comment: Thanks Mark, yes you installed the right package. OK I didn't dig deep enough in the sub class. And yea, there shouldn't be any difference between float.__repr__ and float.__str__. Obviously repr calls the object's tp_repr method, while float.__repr__ calls the base float method, which is the one we want. I didn't do any testing for python 3.x as I couldn't figure out how to import dbus into a local build of 3.x. My mistake here. > For 2.7, we may want to consider processing float instances using `float.__repr__` instead of plain old `repr` That should work! I'll upload a new patch for 2.7 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:03:02 2016 From: report at bugs.python.org (R. David Murray) Date: Fri, 02 Sep 2016 15:03:02 +0000 Subject: [issue27937] logging.getLevelName microoptimization In-Reply-To: <1472805188.28.0.230242025346.issue27937@psf.upfronthosting.co.za> Message-ID: <1472828582.02.0.405569235839.issue27937@psf.upfronthosting.co.za> R. David Murray added the comment: Parens do not cause lazy evaluation unless what is parenthesized is a generator comprehension. An expanded if solution is the correct one. If Vinay prefers a one liner, I think you could also write: _levelToName.get(level) or _nameToLevel.get(level) or ("Level %s" % level) Because we know we get back either a True string or None, I don't think there's any ambiguity there. ---------- nosy: +r.david.murray, vinay.sajip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:03:09 2016 From: report at bugs.python.org (Eddie James) Date: Fri, 02 Sep 2016 15:03:09 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472828589.57.0.57968654199.issue27934@psf.upfronthosting.co.za> Eddie James added the comment: Wait what about the json C code for 2.7? That's still using PyObject_Repr() which will call tp_repr for dbus.Double... Any suggestions? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:07:59 2016 From: report at bugs.python.org (R. David Murray) Date: Fri, 02 Sep 2016 15:07:59 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472828879.69.0.610949411533.issue27934@psf.upfronthosting.co.za> Changes by R. David Murray : ---------- resolution: third party -> stage: resolved -> needs patch status: closed -> open _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:38:16 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 15:38:16 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472830696.08.0.88306181654.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: > That's still using PyObject_Repr() which will call tp_repr for dbus.Double... Any suggestions? Right, you'll want to replace that with a call to `PyFloat_Type.tp_repr(obj)`, as in the Python 3 code. We're in a bit of a grey area here: making this change to the 2.7 branch does require making a case that it's a bugfix rather than a new feature (which isn't permitted in 2.7), *and* that it's not going to cause gratuitous breakage in existing json-using applications. I think there *is* a reasonable case there, but others may disagree. One point in its favour is that we're *already* behaving like a regular float for special values: Python 2.7.12 (default, Jun 29 2016, 12:46:54) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import dbus, json >>> x = dbus.Double(float('inf')) >>> json.dumps(x) # not using repr(x) here 'Infinity' >>> repr(x) 'dbus.Double(inf)' >>> x = dbus.Double(2.3) >>> json.dumps(x) # using repr(x) here 'dbus.Double(2.3)' >>> repr(x) 'dbus.Double(2.3)' ---------- versions: -Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:40:20 2016 From: report at bugs.python.org (Stefan Behnel) Date: Fri, 02 Sep 2016 15:40:20 +0000 Subject: [issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding In-Reply-To: <1472813879.44.0.998977479164.issue27940@psf.upfronthosting.co.za> Message-ID: <1472830820.71.0.439083345378.issue27940@psf.upfronthosting.co.za> Stefan Behnel added the comment: > By the way, I'm surprised that the special encoding "unicode" relies on the *current* locale encoding when the XML declaration is requested. That seems a weird choice. Since it serialises to a Unicode string, it shouldn't have any XML declaration at all, if only to make it easy for users to add one themselves if they feel like it. I guess it's too late to change that now, though... ---------- nosy: +scoder _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 11:50:00 2016 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Fri, 02 Sep 2016 15:50:00 +0000 Subject: [issue27456] asyncio: set TCP_NODELAY flag by default In-Reply-To: <1467732468.65.0.201519937735.issue27456@psf.upfronthosting.co.za> Message-ID: <1472831400.48.0.65613910928.issue27456@psf.upfronthosting.co.za> ???? ????????? added the comment: vote +10 for that ---------- nosy: +mmarkk _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:02:44 2016 From: report at bugs.python.org (Eddie James) Date: Fri, 02 Sep 2016 16:02:44 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472832164.27.0.717968364215.issue27934@psf.upfronthosting.co.za> Changes by Eddie James : Added file: http://bugs.python.org/file44349/json-float-repr-2.7.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:08:13 2016 From: report at bugs.python.org (Eddie James) Date: Fri, 02 Sep 2016 16:08:13 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472832493.89.0.462078610933.issue27934@psf.upfronthosting.co.za> Eddie James added the comment: Python 2.7 also already behaves correctly for other dbus types: Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import dbus >>> import json >>> x = dbus.Int32(3) >>> x dbus.Int32(3) >>> json.dumps(x) '3' >>> repr(x) 'dbus.Int32(3)' ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:30:15 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 16:30:15 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472833815.87.0.17786077151.issue27928@psf.upfronthosting.co.za> Christian Heimes added the comment: You are right. Let's try this again. How do you like: >>> hashlib.scrypt(b'', n=2, r=2, p=3) Traceback (most recent call last): File "", line 1, in TypeError: salt is required >>> hashlib.scrypt(b'', salt=b'') Traceback (most recent call last): File "", line 1, in TypeError: n is required and must be an unsigned int >>> hashlib.scrypt(b'', n=None, r=2, p=3) Traceback (most recent call last): File "", line 1, in TypeError: scrypt() argument 3 must be int, not None ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:31:27 2016 From: report at bugs.python.org (Samuele Santi) Date: Fri, 02 Sep 2016 16:31:27 +0000 Subject: [issue27941] Bad error message from Decimal('garbage') across the py3 range Message-ID: <1472833887.9.0.541510486765.issue27941@psf.upfronthosting.co.za> New submission from Samuele Santi: Looks like, on some occasions, running ``Decimal('garbage')`` on Python 3.x decimal raises this error: decimal.InvalidOperation: [] instead of the usual: decimal.InvalidOperation: Invalid literal for Decimal: 'garbage' This seems to be caused by the built-in decimal module on 3.x, while it's just fine with decimal.py / _pydecimal.py (eg. the system Python on Archlinux). I'm attaching the output from a few tests I made against different interpreters. ---------- files: test-decimal-error-output.txt messages: 274254 nosy: Samuele Santi priority: normal severity: normal status: open title: Bad error message from Decimal('garbage') across the py3 range type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file44350/test-decimal-error-output.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:38:27 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 16:38:27 +0000 Subject: [issue27869] test failures under Bash on Windows In-Reply-To: <1472236837.41.0.811658562373.issue27869@psf.upfronthosting.co.za> Message-ID: <1472834307.82.0.666023735193.issue27869@psf.upfronthosting.co.za> Brett Cannon added the comment: I re-ran the test suite in a directory not under /mnt/c to see if having a different file owner would change things and it did. test_logging and test_socket still hang, but the failures go down to 23: test_asyncio test_asyncore test_eintr test_epoll test_faulthandler test_fcntl test_ftplib test_httpservers test_import test_mmap test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_os test_posix test_resource test_signal test_socketserver test_subprocess test_time test_unicode_file test_wsgiref ---------- title: test failures on Bash on Windows -> test failures under Bash on Windows _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:38:50 2016 From: report at bugs.python.org (Stefan Krah) Date: Fri, 02 Sep 2016 16:38:50 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472834330.96.0.0353623033375.issue22458@psf.upfronthosting.co.za> Stefan Krah added the comment: The reason is that the benchmark is a softball for fractions. Using the fastest fraction implementation (gmpy.mpq) and the best printing method for both types, gmpy.mpq seems to be about 2.5 to 3 times slower than decimal. It is however easy to generate benchmarks where mpq is 3000 times slower, depending on how many prime factors accumulate in the denominator. Fractions will shine in most benchmarks where decimal is exact anyway. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:45:37 2016 From: report at bugs.python.org (Kay Hayen) Date: Fri, 02 Sep 2016 16:45:37 +0000 Subject: [issue27942] Default value identity regression Message-ID: <1472834737.57.0.822205168917.issue27942@psf.upfronthosting.co.za> New submission from Kay Hayen: Consider this: def defaultKeepsIdentity(arg = "str_value"): print(arg is "str_value") defaultKeepsIdentity() This has been outputing "True" on every Python release I have seen so far, but not so on 3.6.0a4. Normally string values come from a "co_const" and will be "is" identical if used as literals in a module, but no longer in this case. This seems wasteful at best, needlessly increasing the number of strings in usage. Yours, Kay ---------- components: Interpreter Core messages: 274257 nosy: Kay.Hayen priority: normal severity: normal status: open title: Default value identity regression type: resource usage versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:53:03 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 16:53:03 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472835183.93.0.432424127628.issue27928@psf.upfronthosting.co.za> Xiang Zhang added the comment: It looks good. But Christian, may I ask how do you generate the argument clinic? It looks from me that the declaration cannot give you such a format "y*|$y*O!O!O!ll:scrypt". I rerun clinic.py and the .c.h file is altered. Maybe it's better to abandon AC for right now? ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 12:53:05 2016 From: report at bugs.python.org (Stefan Krah) Date: Fri, 02 Sep 2016 16:53:05 +0000 Subject: [issue27941] Bad error message from Decimal('garbage') across the py3 range In-Reply-To: <1472833887.9.0.541510486765.issue27941@psf.upfronthosting.co.za> Message-ID: <1472835185.09.0.396845829849.issue27941@psf.upfronthosting.co.za> Stefan Krah added the comment: Hardly a bad error message, but see #26208. ---------- nosy: +skrah resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> decimal C module's exceptions don't match the Python version type: behavior -> enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:10:11 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 02 Sep 2016 17:10:11 +0000 Subject: [issue27931] Email parse IndexError <""@wiarcom.com> In-Reply-To: <1472743779.07.0.918992764498.issue27931@psf.upfronthosting.co.za> Message-ID: <1472836211.17.0.535407928452.issue27931@psf.upfronthosting.co.za> Xiang Zhang added the comment: It should be. If there is anything wrong I'd like to hear and fix. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:17:10 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 17:17:10 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472836630.7.0.826332679913.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: Yes. I'm fairly convinced about the bug part; it's the gratuitous breakage part that worries me. It wouldn't surprise me at all to find that there's someone out there who wants all their numbers to be written out to JSON with exactly 6 places after the point, and subclasses float just for that purpose. (I'm not for a moment suggesting that this is a good idea, but there's a big difference between the set of Python code that *should* have been written and the set of Python code that *has* been written. :-) >>> class MyFloat(float): ... def __repr__(self): ... return '{:.6f}'.format(self) ... >>> import math, json >>> json.dumps(MyFloat(math.pi)) '3.141593' ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:19:50 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Fri, 02 Sep 2016 17:19:50 +0000 Subject: [issue27942] Default value identity regression In-Reply-To: <1472834737.57.0.822205168917.issue27942@psf.upfronthosting.co.za> Message-ID: <1472836790.28.0.751403597074.issue27942@psf.upfronthosting.co.za> Steven D'Aprano added the comment: Can confirm the expected behaviour (printing True) in Python 2.4 through 2.7, 3.3, Jython 2.5, and even venerable old Python 1.5 (where it prints 1). But *not* IronPython 2.6, where it prints False. In 3.6, the difference seems to be here: py> f = defaultKeepsIdentity py> f.__defaults__[0] is f.__code__.co_consts[1] False py> f.__defaults__[0] == f.__code__.co_consts[1] True This behaviour is not specified by the language. Caching and re-use of strings has always been subject to change. Nevertheless, perhaps it is time for this to be make a language feature: inside a function, any use of the same string literal should use the same object? ---------- nosy: +steven.daprano _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:23:12 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 02 Sep 2016 17:23:12 +0000 Subject: [issue27942] Default value identity regression In-Reply-To: <1472834737.57.0.822205168917.issue27942@psf.upfronthosting.co.za> Message-ID: <1472836992.97.0.459399883342.issue27942@psf.upfronthosting.co.za> Serhiy Storchaka added the comment: This likely is an interference of issue27095 with issue26148. I consider this as a regression. This causes not only a waste of memory, but can affect a performance, since comparing non-identical strings is slower than comparing identical strings. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:39:44 2016 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Sep 2016 17:39:44 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1472834330.96.0.0353623033375.issue22458@psf.upfronthosting.co.za> Message-ID: STINNER Victor added the comment: Stefan Krah added the comment: > Fractions will shine in most benchmarks where decimal is exact anyway. According to Stefan's latest message, the purpose of the benchmark is not the compare decimal to fractions, but measure the performance of fractions for one Python implementation. For example, it can be used to check that fractions is faster in Python 3.6 than Python 3.4 fractions. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:44:35 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 17:44:35 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472838275.34.0.764591664502.issue27936@psf.upfronthosting.co.za> Mark Dickinson added the comment: For the record, the float behaviour was changed (for Python 3.5) in http://bugs.python.org/issue19933. There didn't seem to be any particularly strong motivation for that change, but it's done now. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:45:00 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 17:45:00 +0000 Subject: [issue27869] test failures under Bash on Windows In-Reply-To: <1472236837.41.0.811658562373.issue27869@psf.upfronthosting.co.za> Message-ID: <1472838300.72.0.390442997047.issue27869@psf.upfronthosting.co.za> Brett Cannon added the comment: And with the latest patches applied, same hanging tests, but one less failure: test_asyncio test_asyncore test_epoll test_faulthandler test_fcntl test_ftplib test_httpservers test_import test_mmap test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_os test_posix test_resource test_signal test_socketserver test_subprocess test_time test_unicode_file test_wsgiref ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:49:17 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 17:49:17 +0000 Subject: [issue26208] decimal C module's exceptions don't match the Python version In-Reply-To: <1453830419.58.0.782557332566.issue26208@psf.upfronthosting.co.za> Message-ID: <1472838557.17.0.073622645819.issue26208@psf.upfronthosting.co.za> Changes by Mark Dickinson : ---------- nosy: +mark.dickinson _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 13:54:01 2016 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 02 Sep 2016 17:54:01 +0000 Subject: [issue27934] json float encoding incorrect for dbus.Double In-Reply-To: <1472761223.9.0.580662580928.issue27934@psf.upfronthosting.co.za> Message-ID: <1472838841.44.0.123622760016.issue27934@psf.upfronthosting.co.za> Mark Dickinson added the comment: Note that this will also change the results for JSON output of NumPy float64 values, so at the very least I'd expect this change to break (admittedly poorly written) unit tests / doctests. Python 2.7.12 (default, Jul 10 2016, 18:28:23) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> import json >>> x = np.float64(3.3) >>> json.dumps(x) '3.2999999999999998' >>> repr(x) '3.2999999999999998' >>> float.__repr__(x) '3.3' ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 14:00:07 2016 From: report at bugs.python.org (Stefan Krah) Date: Fri, 02 Sep 2016 18:00:07 +0000 Subject: [issue22458] Add fractions benchmark In-Reply-To: <1411369830.75.0.216203072207.issue22458@psf.upfronthosting.co.za> Message-ID: <1472839207.59.0.423166892495.issue22458@psf.upfronthosting.co.za> Stefan Krah added the comment: Which Stefan? :) Anyway, the first half of this issue was centered around the proposition that fractions are a "better decimal", and the latest pull request still has the "decimal backend" in it. :) Fast fractions have been around for a long time (Lisp/sbcl), but apparently they have never been widely used. A fraction-only benchmark is okay, but comparing fractions/decimals in one particular "official" benchmark is a bit strange. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 14:40:23 2016 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 02 Sep 2016 18:40:23 +0000 Subject: [issue27919] Deprecate and remove extra_path distribution kwarg In-Reply-To: <1472670374.61.0.857588658064.issue27919@psf.upfronthosting.co.za> Message-ID: <1472841623.65.0.552092034691.issue27919@psf.upfronthosting.co.za> Jason R. Coombs added the comment: Doing a quick search on Github, it seems there are [537 projects](https://github.com/search?utf8=%E2%9C%93&q=extra_path+filename%3Asetup.py&type=Code&ref=searchresults) indicating `extra_path` in their setup.py. Many (most?) of those are using the feature to group packages into a namespace (Numeric, pygoogle, aeosa) in the filesystem. For each of these groups, it's probably worth contacting someone in the group to reference this ticket and get feedback. Some of those projects just reference the value but set it to the default (disabled) or it's commented out. At least one is using the feature for a load-time behavior injection (https://github.com/jwasinger/mailman_cas/blob/2ad0631001cb57366bb2a3b9d5f8eeddf5472c4e/mailman-2.1.12/misc/KoreanCodecs-2.0.5/setup.py). In that case, I don't think distutils should remain complicit in the hack, but the hack should be owned entirely by the project. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 16:17:03 2016 From: report at bugs.python.org (Ivan Levkivskyi) Date: Fri, 02 Sep 2016 20:17:03 +0000 Subject: [issue27905] Add documentation for typing.Type In-Reply-To: <1472593880.19.0.114422348142.issue27905@psf.upfronthosting.co.za> Message-ID: <1472847423.55.0.153529100773.issue27905@psf.upfronthosting.co.za> Ivan Levkivskyi added the comment: Michael, thank you for helping with this! Please take a look at my comments on the patch. ---------- nosy: +levkivskyi _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 16:26:48 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 20:26:48 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472848008.53.0.318466646751.issue27928@psf.upfronthosting.co.za> Christian Heimes added the comment: It's not a limitation of the argument clinic. PyArg_Parse*() does not support required, keyword-only arguments without a default value. I'm using None as default value, require PyLong_Type and added some extra checks. ---------- Added file: http://bugs.python.org/file44351/Add-hashlib.scrypt-3.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:09:51 2016 From: report at bugs.python.org (Jaroslav) Date: Fri, 02 Sep 2016 21:09:51 +0000 Subject: [issue27902] pstats.Stats: strip_dirs() method cannot handle file paths from different OS In-Reply-To: <1472590175.77.0.992836532809.issue27902@psf.upfronthosting.co.za> Message-ID: <1472850591.49.0.357181901014.issue27902@psf.upfronthosting.co.za> Jaroslav added the comment: The paragraph is ok. I'll open. Thanks a lot. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:16:19 2016 From: report at bugs.python.org (Jaroslav) Date: Fri, 02 Sep 2016 21:16:19 +0000 Subject: [issue27943] pstats.Stats: missing the source OS setting argument in strip_dirs() method Message-ID: <1472850979.95.0.963332245266.issue27943@psf.upfronthosting.co.za> New submission from Jaroslav: Forked from Issue 27902. The method cannot process the paths from different OS correctly. The optional argument will help, default = host OS settings as it is now. ---------- components: Windows messages: 274273 nosy: Jaroslav, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: pstats.Stats: missing the source OS setting argument in strip_dirs() method type: enhancement versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:21:07 2016 From: report at bugs.python.org (tehybel) Date: Fri, 02 Sep 2016 21:21:07 +0000 Subject: [issue27944] two hotshot module issues Message-ID: <1472851267.13.0.573687433663.issue27944@psf.upfronthosting.co.za> New submission from tehybel: Here I'll describe two issues in the "hotshot" module which can be found in /Modules/_hotshot.c. Note that this module is for Python 2.7 only. The issues are (1) an uninitialized variable use and (2) a double free. Issue 1: uninitialized variable usage in unpack_add_info In the function unpack_add_info we have this code: static int unpack_add_info(LogReaderObject *self) { PyObject *key; ... err = unpack_string(self, &key); if (!err) { ... } finally: Py_XDECREF(key); Py_XDECREF(value); return err; } The variable "key" is not initialized to NULL. If the call to unpack_string fails, the code will directly call Py_XDECREF on key which is an uninitialized variable. To fix this we could initialize "key" to NULL. Here's a PoC: --- import hotshot.log WHAT_ADD_INFO = 0x13 open("./tmp", "w").write(chr(WHAT_ADD_INFO)) logreader = hotshot.log.LogReader("./tmp") --- It segfaults here: (gdb) run poc_27_1.py Program received signal SIGSEGV, Segmentation fault. 0x00007ffff696e585 in unpack_add_info (self=0x7ffff6b82098) at /home/xx/Python-2.7.12/Modules/_hotshot.c:370 370 Py_XDECREF(key); (gdb) p *key $3 = {_ob_next = 0x438b480f74fff883, _ob_prev = 0x53894801508d4808, ob_refcnt = 0x9066c35b00b60f08, ob_type = 0x841f0f2e66} Issue 2: double free (Py_DECREF) in unpack_add_info This is a separate issue from the one described above, but it exists in the same function, unpack_add_info: static int unpack_add_info(LogReaderObject *self) { PyObject *key; PyObject *value = NULL; int err; err = unpack_string(self, &key); if (!err) { err = unpack_string(self, &value); if (err) Py_DECREF(key); else { ... } } finally: Py_XDECREF(key); Py_XDECREF(value); return err; } If the second call to unpack_string fails, we call Py_DECREF(key). Then we reach the "finally" block and again call Py_XDECREF(key). So key is getting its refcount dropped twice. To fix this we could simply remove the "if (err)" clause and turn the "else" into "if (!err)". Then we would only have the single call to Py_XDECREF(key) in the "finally" block. Here's a PoC: --- import hotshot.log content = "\x13\x20" content += "A"*0x20 open("./tmp", "w").write(content) logreader = hotshot.log.LogReader("./tmp") --- When run, python dies with SIGABRT here (because it's a debug build with Py_REF_DEBUG defined; otherwise memory would silently be corrupted): (gdb) r ./poc_27_2.py Fatal Python error: /home/xx/Python-2.7.12/Modules/_hotshot.c:370 object at 0x7ffff6b7e220 has negative ref count -2604246222170760230 Program received signal SIGABRT, Aborted. 0x00007ffff7143295 in raise () from /usr/lib/libc.so.6 ---------- components: Extension Modules messages: 274274 nosy: tehybel priority: normal severity: normal status: open title: two hotshot module issues versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:33:28 2016 From: report at bugs.python.org (tehybel) Date: Fri, 02 Sep 2016 21:33:28 +0000 Subject: [issue27945] five dictobject issues Message-ID: <1472852008.61.0.354257945943.issue27945@psf.upfronthosting.co.za> New submission from tehybel: Here I'll describe five distinct issues I found. Common to them all is that they reside in the built-in dictionary object. Four of them are use-after-frees and one is an array-out-of-bounds indexing bug. All of the described functions reside in /Objects/dictobject.c. Issue 1: use-after-free when initializing a dictionary Initialization of a dictionary happens via the function dict_init which calls dict_update_common. From there, PyDict_MergeFromSeq2 may be called, and that is where this issue resides. In PyDict_MergeFromSeq2 we retrieve a sequence of size 2 with this line: fast = PySequence_Fast(item, ""); After checking its size, we take out a key and value: key = PySequence_Fast_GET_ITEM(fast, 0); value = PySequence_Fast_GET_ITEM(fast, 1); Then we call PyDict_GetItem. This calls back to Python code if the key has a __hash__ function. From there the "item" sequence could get modified, resulting in "key" or "value" getting used after having been freed. Here's a PoC: --- class X: def __hash__(self): pair[:] = [] return 13 pair = [X(), 123] dict([pair]) --- It crashes while trying to use freed memory as a PyObject: (gdb) run ./poc24.py Program received signal SIGSEGV, Segmentation fault. 0x000000000048fe25 in insertdict (mp=mp at entry=0x7ffff6d5c4b8, key=key at entry=0x7ffff6d52538, hash=0xd, value=value at entry=0x8d1ac0 ) at Objects/dictobject.c:831 831 MAINTAIN_TRACKING(mp, key, value); (gdb) print *key $26 = {_ob_next = 0xdbdbdbdbdbdbdbdb, _ob_prev = 0xdbdbdbdbdbdbdbdb, ob_refcnt = 0xdbdbdbdbdbdbdbdb, ob_type = 0xdbdbdbdbdbdbdbdb} Issue 2: use-after-free in dictitems_contains In the function dictitems_contains we call PyDict_GetItem to look up a value in the dictionary: found = PyDict_GetItem((PyObject *)dv->dv_dict, key); However this "found" variable is borrowed. We then go ahead and compare it: return PyObject_RichCompareBool(value, found, Py_EQ); But PyObject_RichCompareBool could call back into Python code and e.g. release the GIL. As a result, the dictionary may be mutated. Thus "found" could get freed. Then, inside PyObject_RichCompareBool (actually in do_richcompare), the "found" variable gets used after being freed. PoC: --- class X: def __eq__(self, other): d.clear() return NotImplemented d = {0: set()} (0, X()) in d.items() --- Result: (gdb) run ./poc25.py Program received signal SIGSEGV, Segmentation fault. 0x00000000004a03b6 in do_richcompare (v=v at entry=0x7ffff6d52468, w=w at entry=0x7ffff6ddf7c8, op=op at entry=0x2) at Objects/object.c:673 673 if (!checked_reverse_op && (f = w->ob_type->tp_richcompare) != NULL) { (gdb) print w->ob_type $26 = (struct _typeobject *) 0xdbdbdbdbdbdbdbdb Issue 3: use-after-free in dict_equal In the function dict_equal, we call the "lookdict" function via b->ma_keys->dk_lookup to look up a value: if ((b->ma_keys->dk_lookup)(b, key, ep->me_hash, &vaddr) == NULL) This value's address is stored into the "vaddr" variable and the value is fetched into the "bval" variable: bval = *vaddr; Then we call Py_DECREF(key) which can call back into Python code. This could release the GIL and mutate dictionary b. Therefore "bval" could become freed at this point. We then proceed to use "bval": cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); This results in a use-after-free. PoC: --- class X(): def __del__(self): dict_b.clear() def __eq__(self, other): dict_a.clear() return True def __hash__(self): return 13 dict_a = {X(): 0} dict_b = {X(): X()} dict_a == dict_b --- Result: (gdb) run ./poc26.py Program received signal SIGSEGV, Segmentation fault. PyType_IsSubtype (a=0xdbdbdbdbdbdbdbdb, b=0x87ec60 ) at Objects/typeobject.c:1343 1343 mro = a->tp_mro; (gdb) print a $59 = (PyTypeObject *) 0xdbdbdbdbdbdbdbdb Issue 4: use-after-free in _PyDict_FromKeys The function _PyDict_FromKeys takes an iterable as argument. If the iterable is a dict, _PyDict_FromKeys loops over it like this: while (_PyDict_Next(iterable, &pos, &key, &oldvalue, &hash)) { if (insertdict(mp, key, hash, value)) { ... } } However if we look at the comment for PyDict_Next, we see this: * CAUTION: In general, it isn't safe to use PyDict_Next in a loop that * mutates the dict. But insertdict can call on to Python code which might mutate the dict. In that case we perform a use-after-free of the "key" variable. Here's a PoC: --- class X(int): def __hash__(self): return 13 def __eq__(self, other): if len(d) > 1: d.clear() return False d = {} d = {X(1): 1, X(2): 2} x = {}.fromkeys(d) --- And the result: (gdb) run ./poc27.py Program received signal SIGSEGV, Segmentation fault. 0x0000000000435122 in visit_decref (op=0x7ffff6d5ca68, data=0x0) at Modules/gcmodule.c:373 373 if (PyObject_IS_GC(op)) { (gdb) print *op $115 = {_ob_next = 0xdbdbdbdbdbdbdbdb, _ob_prev = 0xdbdbdbdbdbdbdbdb, ob_refcnt = 0xdbdbdbdbdbdbdbdb, ob_type = 0xdbdbdbdbdbdbdbdb} An almost identical issue also exists further down in the function when calling _PySet_NextEntry. To see this crash, just change "d" to be a set in the PoC above: d = set() d = set([X(1), X(2)]) this likewise crashes with a use-after-free. (Note: if you grep for PyDict_Next you will find more similar cases, although many are in obscure modules or deprecated functions. I'm not sure those are worth fixing? E.g. here's a crasher for BaseException_setstate which also calls PyDict_Next: --- class X(str): def __hash__(self): d.clear() return 13 d = {} d[X()] = X() e = Exception() e.__setstate__(d) --- end note.) Issue 5: out-of-bounds indexing in dictiter_iternextitem The function dictiter_iternextitem is used to iterate over a dictionary's items. dictiter_iternextitem is careful to check that the dictionary did not change size during iteration. However after performing this check, it calls Py_DECREF: Py_DECREF(PyTuple_GET_ITEM(result, 0)); Py_DECREF(PyTuple_GET_ITEM(result, 1)); This can execute Python code and mutate the dict. If that happens, the index "i" previously computed by dictiter_iternextitem could become invalid. It would then index out of bounds with this line: key = d->ma_keys->dk_entries[i].me_key; Furthermore the "value_ptr" variable would have gone stale, too. Taking the "value" variable out of it uses memory that has been freed: value = *value_ptr; Here's a PoC which crashes with the "value" variable being an arbitrary pointer: --- class X(int): def __del__(self): d.clear() d = {i: X(i) for i in range(8)} for result in d.items(): if result[0] == 2: d[2] = None # free d[2] --> X(2).__del__ is called --- The result: (gdb) run ./poc29.py Program received signal SIGSEGV, Segmentation fault. dictiter_iternextitem (di=0x7ffff6d49cd8) at Objects/dictobject.c:3187 3187 Py_INCREF(key); (gdb) print value $12 = (PyObject *) 0x7b7b7b7b7b7b7b7b ---------- components: Interpreter Core messages: 274275 nosy: tehybel priority: normal severity: normal status: open title: five dictobject issues _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:34:33 2016 From: report at bugs.python.org (tehybel) Date: Fri, 02 Sep 2016 21:34:33 +0000 Subject: [issue27945] five dictobject issues In-Reply-To: <1472852008.61.0.354257945943.issue27945@psf.upfronthosting.co.za> Message-ID: <1472852073.61.0.620326953014.issue27945@psf.upfronthosting.co.za> Changes by tehybel : ---------- versions: +Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:45:42 2016 From: report at bugs.python.org (Emanuel Barry) Date: Fri, 02 Sep 2016 21:45:42 +0000 Subject: [issue27945] Various segfaults with dict In-Reply-To: <1472852008.61.0.354257945943.issue27945@psf.upfronthosting.co.za> Message-ID: <1472852742.08.0.735459513453.issue27945@psf.upfronthosting.co.za> Changes by Emanuel Barry : ---------- nosy: +ebarry, larry, ned.deily, rhettinger, serhiy.storchaka priority: normal -> critical stage: -> needs patch title: five dictobject issues -> Various segfaults with dict type: -> crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:48:01 2016 From: report at bugs.python.org (tehybel) Date: Fri, 02 Sep 2016 21:48:01 +0000 Subject: [issue27946] issues in elementtree and elsewhere due to PyDict_GetItem Message-ID: <1472852881.19.0.987799736928.issue27946@psf.upfronthosting.co.za> New submission from tehybel: I would like to describe an issue in the _elementtree module, and then propose a fix which would prevent this type of bug everywhere in the codebase. The issue exists in _elementtree_Element_get_impl in /Modules/_elementtree.c. Here is the code: static PyObject * _elementtree_Element_get_impl(ElementObject *self, PyObject *key, PyObject *default_value) { PyObject* value; if (...) value = default_value; else { value = PyDict_GetItem(self->extra->attrib, key); ... } ... } We look up "key" in the dictionary, that is, in self->extra->attrib. This is done with the call to PyDict_GetItem(self->extra->attrib, key). We need to hash the "key" object in order to find it in the dictionary. This sometimes requires calling the key's __hash__ function, i.e., it might call on to python code. What happens if the python code gets the dictionary (self->extra->attrib) freed? Then PyDict_GetItem will use it after it has been freed. I've attached a proof-of-concept script which causes a use-after-free through _elementtree_Element_get_impl due to this issue. We could fix this by calling Py_INCREF on self->extra->attrib before calling PyDict_GetItem. But grepping for "PyDict_GetItem.*\->" shows that there are many places in the codebase where this situation occurs. Some of these may not have much impact, but some of them likely will. All these bugs could be fixed at once by changing PyDict_GetItem to call Py_INCREF on the dictionary before it hashes the key. Here's a PoC for the _elementtree module. --- begin script --- import _elementtree as et state = { "tag": "tag", "_children": [], "attrib": "attr", "tail": "tail", "text": "text", } class X: def __hash__(self): e.__setstate__(state) # this frees e->extra->attrib return 13 e = et.Element("elem", {1: 2}) e.get(X()) --- end script --- Running it (64-bits Python 3.5.2, --with-pydebug) causes a use-after-free with control of the program counter: (gdb) r ./poc13.py Starting program: /home/xx/Python-3.5.2/python ./poc13.py Program received signal SIGSEGV, Segmentation fault. 0x00000000004939af in PyDict_GetItem (op=0x7ffff6d5b1a8, key=0x7ffff6d528e0) at Objects/dictobject.c:1079 1079 ep = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr); (gdb) p mp->ma_keys->dk_lookup $8 = (dict_lookup_func) 0x7b7b7b7b7b7b7b7b ---------- components: Extension Modules messages: 274276 nosy: tehybel priority: normal severity: normal status: open title: issues in elementtree and elsewhere due to PyDict_GetItem versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 17:58:08 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 21:58:08 +0000 Subject: [issue26359] CPython build options for out-of-the box performance In-Reply-To: <1455445693.01.0.984013993837.issue26359@psf.upfronthosting.co.za> Message-ID: <1472853488.98.0.716820992225.issue26359@psf.upfronthosting.co.za> Changes by Brett Cannon : ---------- assignee: brett.cannon -> dependencies: +CPython fails to build modules with LLVM LTO on Mac OS X _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 18:26:01 2016 From: report at bugs.python.org (Christian Heimes) Date: Fri, 02 Sep 2016 22:26:01 +0000 Subject: [issue27945] Various segfaults with dict In-Reply-To: <1472852008.61.0.354257945943.issue27945@psf.upfronthosting.co.za> Message-ID: <1472855161.41.0.906216427314.issue27945@psf.upfronthosting.co.za> Changes by Christian Heimes : ---------- nosy: +christian.heimes _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 18:26:32 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 22:26:32 +0000 Subject: [issue26359] CPython build options for out-of-the box performance In-Reply-To: <1455445693.01.0.984013993837.issue26359@psf.upfronthosting.co.za> Message-ID: <1472855192.85.0.422400460922.issue26359@psf.upfronthosting.co.za> Brett Cannon added the comment: So if I enable this manually, I get various test failures from modules on OS X El Capitan with the same type of failure: [ 95/398] test_bytes Traceback (most recent call last): File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/__main__.py", line 3, in regrtest.main_in_temp_cwd() File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/regrtest.py", line 1593, in main_in_temp_cwd main() File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/regrtest.py", line 756, in main raise Exception("Child error on {}: {}".format(test, result[1])) Exception: Child error on test_bytes: Exit code -6 Since I can't get the test suite to pass with PGO+LTO I'm not comfortable committing this patch and promoting people turn them on. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 18:34:46 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 22:34:46 +0000 Subject: [issue21122] CPython fails to build modules with LLVM LTO on Mac OS X In-Reply-To: <1396354260.96.0.514432416417.issue21122@psf.upfronthosting.co.za> Message-ID: <1472855686.17.0.775908025369.issue21122@psf.upfronthosting.co.za> Brett Cannon added the comment: Here is a patch to turn on `-Wl,-export_dynamic` when building with LTO. Unfortunately I have a bunch of tests that fail when running with LTO+PGO of the form of: [ 95/398] test_bytes Traceback (most recent call last): File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/__main__.py", line 3, in regrtest.main_in_temp_cwd() File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/regrtest.py", line 1593, in main_in_temp_cwd main() File "/Users/brettcannon/Repositories/python/cpython/3.5/Lib/test/regrtest.py", line 756, in main raise Exception("Child error on {}: {}".format(test, result[1])) Exception: Child error on test_bytes: Exit code -6 ---------- keywords: +patch resolution: fixed -> status: closed -> open Added file: http://bugs.python.org/file44352/issue21122.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 18:34:59 2016 From: report at bugs.python.org (Brett Cannon) Date: Fri, 02 Sep 2016 22:34:59 +0000 Subject: [issue21122] CPython fails to build modules with LLVM LTO on Mac OS X In-Reply-To: <1396354260.96.0.514432416417.issue21122@psf.upfronthosting.co.za> Message-ID: <1472855699.31.0.378602379492.issue21122@psf.upfronthosting.co.za> Changes by Brett Cannon : ---------- components: +Macintosh _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 18:50:39 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 22:50:39 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <20160902225036.104204.62622.9918B05B@psf.io> Roundup Robot added the comment: New changeset 31586a2f01b6 by Ethan Furman in branch 'default': issue23591: optimize _high_bit() https://hg.python.org/cpython/rev/31586a2f01b6 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 19:32:51 2016 From: report at bugs.python.org (Roundup Robot) Date: Fri, 02 Sep 2016 23:32:51 +0000 Subject: [issue23591] enum: Add Flags and IntFlags In-Reply-To: <1425569483.33.0.144069723147.issue23591@psf.upfronthosting.co.za> Message-ID: <20160902233248.47480.10449.C7C759D5@psf.io> Roundup Robot added the comment: New changeset f33fc2117bb2 by Ethan Furman in branch 'default': issue23591: bool(empty_flags) == False; more docs & tests https://hg.python.org/cpython/rev/f33fc2117bb2 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 19:57:33 2016 From: report at bugs.python.org (Alex Gaynor) Date: Fri, 02 Sep 2016 23:57:33 +0000 Subject: [issue27928] Add hashlib.scrypt In-Reply-To: <1472732959.81.0.0491310720646.issue27928@psf.upfronthosting.co.za> Message-ID: <1472860653.31.0.315970798983.issue27928@psf.upfronthosting.co.za> Alex Gaynor added the comment: Bug in the error message "n must be a multiple of 2." it should say "n must be a power of 2." ---------- nosy: +alex _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 21:06:31 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Sat, 03 Sep 2016 01:06:31 +0000 Subject: [issue27939] Tkinter mainloop raises when setting the value of ttk.LabeledScale In-Reply-To: <1472811634.57.0.400970918265.issue27939@psf.upfronthosting.co.za> Message-ID: <1472864791.49.0.307410232948.issue27939@psf.upfronthosting.co.za> Changes by Terry J. Reedy : ---------- nosy: +serhiy.storchaka stage: -> needs patch type: crash -> behavior versions: +Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 22:47:54 2016 From: report at bugs.python.org (cfgbd) Date: Sat, 03 Sep 2016 02:47:54 +0000 Subject: [issue27947] Bug of python interpreter Message-ID: <1472870874.89.0.189618974966.issue27947@psf.upfronthosting.co.za> New submission from cfgbd: In python shell, I typed words and got result as follows. It seems that the use of 'r' before a literal string may cause an error that the an odd '\' at the end of literal string blocked the quote. >>> rb'abc\\\' SyntaxError: EOL while scanning string literal >>> rb'abc\\' b'abc\\\\' >>> br'abc\\\ ' b'abc\\\\\\ ' >>> br'abc\\\' SyntaxError: EOL while scanning string literal >>> r'\\' '\\\\' >>> r'\\\' SyntaxError: EOL while scanning string literal ---------- messages: 274282 nosy: cfgbd priority: normal severity: normal status: open title: Bug of python interpreter type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 23:03:12 2016 From: report at bugs.python.org (Ammar Askar) Date: Sat, 03 Sep 2016 03:03:12 +0000 Subject: [issue27947] Trailing backslash in raw string format causes EOL In-Reply-To: <1472870874.89.0.189618974966.issue27947@psf.upfronthosting.co.za> Message-ID: <1472871792.92.0.0330659561202.issue27947@psf.upfronthosting.co.za> Ammar Askar added the comment: This isn't a bug, in fact this very behavior is documented within the string docs, please read the last paragraph here: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals ---------- nosy: +ammar2 title: Bug of python interpreter -> Trailing backslash in raw string format causes EOL _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 23:05:31 2016 From: report at bugs.python.org (Tim Peters) Date: Sat, 03 Sep 2016 03:05:31 +0000 Subject: [issue27947] Trailing backslash in raw string format causes EOL In-Reply-To: <1472870874.89.0.189618974966.issue27947@psf.upfronthosting.co.za> Message-ID: <1472871931.37.0.720521745387.issue27947@psf.upfronthosting.co.za> Changes by Tim Peters : ---------- resolution: -> not a bug stage: -> resolved status: open -> closed versions: +Python 3.2 -Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 2 23:12:11 2016 From: report at bugs.python.org (cfgbd) Date: Sat, 03 Sep 2016 03:12:11 +0000 Subject: [issue27947] Trailing backslash in raw string format causes EOL In-Reply-To: <1472870874.89.0.189618974966.issue27947@psf.upfronthosting.co.za> Message-ID: <1472872331.49.0.992463291438.issue27947@psf.upfronthosting.co.za> cfgbd added the comment: Thanks for comment. Here I got my answer from string docs. Even in a raw literal, quotes can be escaped with a backslash, but the backslash remains in the result; for example, r"\"" is a valid string literal consisting of two characters: a backslash and a double quote; r"\" is not a valid string literal (even a raw string cannot end in an odd number of backslashes). Specifically, a raw literal cannot end in a single backslash (since the backslash would escape the following quote character). Note also that a single backslash followed by a newline is interpreted as those two characters as part of the literal, not as a line continuation. ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 00:33:39 2016 From: report at bugs.python.org (Zachary Ware) Date: Sat, 03 Sep 2016 04:33:39 +0000 Subject: [issue27883] Update sqlite version for Windows build In-Reply-To: <1472383089.76.0.501181258195.issue27883@psf.upfronthosting.co.za> Message-ID: <1472877219.21.0.355131672256.issue27883@psf.upfronthosting.co.za> Zachary Ware added the comment: I agree, we should update our sqlite version. I'll try to get to this next week, but it shouldn't be a big deal if it misses beta 1 since it's not a new feature. ---------- stage: -> needs patch title: sqlite-3.14.1 for Python_3.6.0b1 ? -> Update sqlite version for Windows build _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 00:38:19 2016 From: report at bugs.python.org (Zachary Ware) Date: Sat, 03 Sep 2016 04:38:19 +0000 Subject: [issue19489] move quick search box above TOC In-Reply-To: <1383546510.68.0.587653327623.issue19489@psf.upfronthosting.co.za> Message-ID: <1472877499.27.0.457230237049.issue19489@psf.upfronthosting.co.za> Zachary Ware added the comment: Berker, would you mind giving this another look? If you give it the OK, I can get it committed if you don't beat me to it. ---------- assignee: docs at python -> berker.peksag _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 01:35:34 2016 From: report at bugs.python.org (Stefan Behnel) Date: Sat, 03 Sep 2016 05:35:34 +0000 Subject: [issue19108] Benchmark runner tries to execute external Python command and fails on error reporting In-Reply-To: <1380297636.45.0.339184347104.issue19108@psf.upfronthosting.co.za> Message-ID: <1472880934.37.0.92623558552.issue19108@psf.upfronthosting.co.za> Stefan Behnel added the comment: Let's close this as outdated. New bugs for the new project should be reported in github anyway. ---------- resolution: -> out of date status: open -> closed _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 03:44:42 2016 From: report at bugs.python.org (Armin Rigo) Date: Sat, 03 Sep 2016 07:44:42 +0000 Subject: [issue25653] ctypes+callbacks+fork+selinux = crash In-Reply-To: <1447826584.36.0.973987165664.issue25653@psf.upfronthosting.co.za> Message-ID: <1472888682.84.0.81965844381.issue25653@psf.upfronthosting.co.za> Armin Rigo added the comment: Attached trivial example. This gives for me a bus error when run with selinux (actually tested by changing the "return 0;" to "return 1;" in selinux_enabled_check() file Modules/_ctypes/libffi/src/closures.c). If you comment out any of the two do_stuff() calls, everything works fine. ---------- Added file: http://bugs.python.org/file44353/x.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 03:45:16 2016 From: report at bugs.python.org (Armin Rigo) Date: Sat, 03 Sep 2016 07:45:16 +0000 Subject: [issue25653] ctypes+callbacks+fork+selinux = crash In-Reply-To: <1447826584.36.0.973987165664.issue25653@psf.upfronthosting.co.za> Message-ID: <1472888716.53.0.82488381012.issue25653@psf.upfronthosting.co.za> Changes by Armin Rigo : ---------- versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 04:57:57 2016 From: report at bugs.python.org (Raymond Hettinger) Date: Sat, 03 Sep 2016 08:57:57 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <1472893077.23.0.168515392432.issue27936@psf.upfronthosting.co.za> Changes by Raymond Hettinger : ---------- assignee: -> rhettinger resolution: -> fixed status: open -> closed versions: +Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 04:55:50 2016 From: report at bugs.python.org (Roundup Robot) Date: Sat, 03 Sep 2016 08:55:50 +0000 Subject: [issue27936] Inconsistent round behavior between float and int In-Reply-To: <1472799175.75.0.400083322493.issue27936@psf.upfronthosting.co.za> Message-ID: <20160903085547.22588.26190.3EC634AB@psf.io> Roundup Robot added the comment: New changeset c3c4d8e4ca1a by Raymond Hettinger in branch '3.5': Issue 27936: Fix inconsistent round() behavior between float and int https://hg.python.org/cpython/rev/c3c4d8e4ca1a ---------- nosy: +python-dev _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 05:55:09 2016 From: report at bugs.python.org (Christian Heimes) Date: Sat, 03 Sep 2016 09:55:09 +0000 Subject: [issue25653] ctypes+callbacks+fork+selinux = crash In-Reply-To: <1447826584.36.0.973987165664.issue25653@psf.upfronthosting.co.za> Message-ID: <1472896509.47.0.426783122347.issue25653@psf.upfronthosting.co.za> Changes by Christian Heimes : ---------- nosy: +christian.heimes _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 06:07:28 2016 From: report at bugs.python.org (Christian Heimes) Date: Sat, 03 Sep 2016 10:07:28 +0000 Subject: [issue25653] ctypes+callbacks+fork+selinux = crash In-Reply-To: <1447826584.36.0.973987165664.issue25653@psf.upfronthosting.co.za> Message-ID: <1472897248.23.0.810503651354.issue25653@psf.upfronthosting.co.za> Christian Heimes added the comment: Thanks Armin, I didn't know that your reported the bug in bugs.python.org until today. Last year Armin and I spent a good amount of time to analyse the situation. Armin was able to come up with a different callback implementation for cffi that that does not use W/X memory mappings. The problem affects mod_wsgi applications on SELinux systems (Fedora, CentOS, RHEL). For security reasons SELinux prevents Apache HTTPD to have writeable and executable memory pages. FFI callbacks with dynamic closures either require the fd workaround (which is buggy) or the application segfaults. https://bugzilla.redhat.com/show_bug.cgi?id=1277224 https://bugzilla.redhat.com/show_bug.cgi?id=1337141 https://bugzilla.redhat.com/show_bug.cgi?id=1249685 ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 08:27:24 2016 From: report at bugs.python.org (Martin Panter) Date: Sat, 03 Sep 2016 12:27:24 +0000 Subject: [issue27923] PEP 467 -- Minor API improvements for binary sequences In-Reply-To: <1472691379.75.0.669592694643.issue27923@psf.upfronthosting.co.za> Message-ID: <1472905644.09.0.302623025423.issue27923@psf.upfronthosting.co.za> Martin Panter added the comment: Sorry Elias for not explaining my commands. xclip was just my way of pasting the patch URL from the clipboard (that I copied from Firefox). It is not clear if we are actually making a DeprecationWarning, or going down the road of changing all the stdlib. But if we do, there are a couple of bits of Serhiy?s patch that I would rewrite more plainly, e.g. bytearray(b'\0\0') * len(...) instead of bytearray(b'\0') * (2 * len(...)). ---------- _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Sep 3 08:33:47 2016 From: report at bugs.python.org (Berker Peksag) Date: Sat, 03 Sep 2016 12:33:47 +0000 Subject: [issue19489] move quick search box above TOC In-Reply-To: <1383546510.68.0.587653327623.issue19489@psf.upfronthosting.co.za> Message-ID: <1472906027.05.0.638523456241.issue19489@psf.upfronthosting.co.za> Berker Peksag added the comment: > Do you mean in addition to the "Quick search" text that is already on the page or do you want to remove that? The latter. All of the popular browsers (Chrome, Firefox, Edge and even Safari) already support the placeholder attribute so I think we can safely ignore IE 8 :) > What problems are you thinking of? Honestly, I can't remember now, but I was talking about old Chrome and Firefox versions. Let's ignore my comment for now. I have two more minor comments: 1. +