[issue43224] Add support for PEP 646

2022-03-25 Thread Matthew Rahtz
Change by Matthew Rahtz : -- pull_requests: +30197 pull_request: https://github.com/python/cpython/pull/32119 ___ Python tracker <https://bugs.python.org/issue43

[issue43224] Add support for PEP 646

2022-03-25 Thread Matthew Rahtz
Matthew Rahtz added the comment: Since things are piling up, here's a quick record of what I think the remaining tasks are: (in approximate order of priority) 1. Finish writing docs (is updating library/typing.html sufficient? https://github.com/python/cpython/pull/32103) 2. Impl

[issue43224] Add support for PEP 646

2022-03-28 Thread Matthew Rahtz
Change by Matthew Rahtz : -- pull_requests: +30237 pull_request: https://github.com/python/cpython/pull/32159 ___ Python tracker <https://bugs.python.org/issue43

[issue47152] Reorganize the re module sources

2022-04-04 Thread Matthew Barnett
Matthew Barnett added the comment: For reference, I also implemented .regs in the regex module for compatibility, but I've never used it myself. I had to do some investigating to find out what it did! It returns a tuple of the spans of the groups. Perhaps I might have used it if it d

[issue43224] Add support for PEP 646

2022-04-04 Thread Matthew Rahtz
Matthew Rahtz added the comment: > 1. Finish writing docs Done once https://github.com/python/cpython/pull/32103 is merged. > 2. Implement support for pickling of unpacked native tuples Done once https://github.com/python/cpython/pull/32159 is merged. 4. Resolve the issue of

[issue47006] PEP 646: Decide on substitution behavior

2022-04-04 Thread Matthew Rahtz
Matthew Rahtz added the comment: Apologies for the slow reply - coming back to this now that the docs and pickling issues are mostly sorted. [Serhiy] > > Alias = C[T, *Ts] > > Alias2 = Alias[*tuple[int, ...]] > > # Alias2 should be C[int, *tuple[int, ...]] > > tuple

[issue47006] PEP 646: Decide on substitution behavior

2022-04-05 Thread Matthew Rahtz
Matthew Rahtz added the comment: [Guido] > 1. Some edge case seems to be that if *tuple[...] is involved on either side > we will never simplify. Alright, let me think this through with some examples to get my head round it. It would prohibit the following difficult case: class C(G

[issue47006] PEP 646: Decide on substitution behavior

2022-04-05 Thread Matthew Rahtz
Change by Matthew Rahtz : -- keywords: +patch pull_requests: +30396 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32341 ___ Python tracker <https://bugs.python.org/issu

[issue47006] PEP 646: Decide on substitution behavior

2022-04-05 Thread Matthew Rahtz
Matthew Rahtz added the comment: Ok, https://github.com/python/cpython/pull/32341/files is a reference of how the current implementation behaves. Fwiw, it *is* mostly correct - with a few minor tweaks it might be alright for at least the 3.11 release. In particular, instead of dealing with

[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Matthew Barnett
Matthew Barnett added the comment: You wrote "the u had already been removed by hand". By removing the u in the _Python 2_ code, you changed that string from a Unicode string to a bytestring. In a bytestring, \u is not an escape; b"\u" == b"\\u".

[issue38582] re: backreference number in replace string can't >= 100

2019-10-24 Thread Matthew Barnett
Matthew Barnett added the comment: A numeric escape of 3 digits is an octal (base 8) escape; the octal escape "\100" gives the same character as the hexadecimal escape "\x40". In a replacement template, you can use "\g<100>" if you want group 100 becau

[issue38582] re: backreference number in replace string can't >= 100

2019-10-25 Thread Matthew Barnett
Matthew Barnett added the comment: If we did decide to remove it, but there was still a demand for octal escapes, then I'd suggest introducing \oXXX. -- ___ Python tracker <https://bugs.python.org/is

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-27 Thread Matthew Barnett
Matthew Barnett added the comment: Suppose you had a pattern: .* It would advance one character on each iteration of the * until the . failed to match. The text is finite, so it would stop matching eventually. Now suppose you had a pattern: (?:)* On each iteration of the * it

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Matthew Barnett
Matthew Barnett added the comment: It's been many years since I looked at the code, and there have been changes since then, so some of the details might not be correct. As to have it should behave: re.match('(?:()|(?(1)()|z)){1,2}(?(2)a|z)', 'a') Iteration 1. Match

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-11 Thread Matthew Suozzo
New submission from Matthew Suozzo : An unfortunately common pattern over large codebases of Python tests is for spec'd Mock instances to be provided with Mock objects as their specs. This gives the false sense that a spec constraint is being applied when, in fact, nothing will be disal

[issue43322] Inconsistent '#include' notation in extensions tutorial doc

2021-03-13 Thread Matthew Hughes
Change by Matthew Hughes : -- keywords: +patch pull_requests: +23612 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24851 ___ Python tracker <https://bugs.python.org/issu

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-15 Thread Matthew Suozzo
Matthew Suozzo added the comment: I've fixed a bunch of these in our internal repo so I'd be happy to add that to a patch implementing raising exceptions for these cases. -- ___ Python tracker <https://bugs.python.o

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo
Matthew Suozzo added the comment: A few more things: Assertions on Mock-autospec'ed Mocks will silently pass since e.g. assert_called_once_with will now be mocked out. This may justify a more stringent stance on the pattern since it risks hiding real test failures. One complicating f

[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo
Matthew Suozzo added the comment: And to give some context for the above autospec child bit, this is the relevant code that determines the spec to use for each child: https://github.com/python/cpython/blob/master/Lib/unittest/mock.py#L2671-L2696

[issue43535] Make str.join auto-convert inputs to strings.

2021-03-19 Thread Matthew Barnett
Matthew Barnett added the comment: I'm also -1, for the same reason as Serhiy gave. However, if it was opt-in, then I'd be OK with it. -- nosy: +mrabarnett ___ Python tracker <https://bugs.python.o

[issue43714] re.split(), re.sub(): '\Z' must consume end of string if it matched

2021-04-03 Thread Matthew Barnett
Matthew Barnett added the comment: Do any other regex implementations behave the way you want? In my experience, there's no single "correct" way for a regex to behave; different implementations might give slightly different results, so if the most common ones behave a ce

[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo
New submission from Matthew Suozzo : Given the increasing use of long `from typing import foo, bar, ...` import sequences, it's becoming more desirable to address individual components of the import node. Unfortunately, the ast.alias node doesn't contain source location metadata (e

[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo
Change by Matthew Suozzo : -- keywords: +patch pull_requests: +24059 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25324 ___ Python tracker <https://bugs.python.org/issu

[issue43798] Add position metadata to alias AST type

2021-04-09 Thread Matthew Suozzo
Matthew Suozzo added the comment: Ah and one other question: Is this normally the sort of thing that would get backported? It should be very straightforward to do so, at least for 3.9 given the support for the new parser. -- versions: -Python 3.6, Python 3.7, Python 3.8

[issue43478] Disallow Mock spec arguments from being Mocks

2021-04-09 Thread Matthew Suozzo
Change by Matthew Suozzo : -- keywords: +patch nosy: +matthew.suozzo nosy_count: 7.0 -> 8.0 pull_requests: +24061 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25326 ___ Python tracker <https://bugs.p

[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2021-04-09 Thread Matthew Suozzo
Matthew Suozzo added the comment: I don't think this was actually fixed for the create_autospec case. create_autospec still uses the only is_async_func check to enable use of AsyncMock and that still does a __code__ check. There was a test submitted to check this case but the test i

[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2021-04-11 Thread Matthew Suozzo
Change by Matthew Suozzo : -- pull_requests: +24081 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25347 ___ Python tracker <https://bugs.python.org/issu

[issue28937] str.split(): allow removing empty strings (when sep is not None)

2021-05-18 Thread Matthew Barnett
Matthew Barnett added the comment: The case: ' a b c '.split(maxsplit=1) == ['a', 'b c '] suggests that empty strings don't count towards maxsplit, otherwise it would return [' a b c '] (i.e. the split would give ['', ' a

[issue28937] str.split(): allow removing empty strings (when sep is not None)

2021-05-18 Thread Matthew Barnett
Matthew Barnett added the comment: The best way to think of it is that .split() is like .split(' '), except that it's splitting on any whitespace character instead of just ' ', and keepempty is defaulting to False instead of True. Therefore: ' x y z

[issue28937] str.split(): allow removing empty strings (when sep is not None)

2021-05-18 Thread Matthew Barnett
Matthew Barnett added the comment: We have that already, although it's spelled: ' x y z'.split(maxsplit=1) == ['x', 'y z'] because the keepempty option doesn't exist yet. -- ___ Python trac

[issue28937] str.split(): allow removing empty strings (when sep is not None)

2021-05-21 Thread Matthew Barnett
Matthew Barnett added the comment: I've only just realised that the test cases don't cover all eventualities: none of them test what happens with multiple spaces _between_ the letters, such as: ' a b c '.split(maxsplit=1) == ['a', 'b c '] Com

[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-10 Thread Matthew Clapp
New submission from Matthew Clapp : The docs for the venv module, EnvBuilder class, ensure_directories method, describe behavior that doesn't match what its actual behavior is, (and what the code is). I propose to update the documentation of the API to match the actual behavior.

[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-10 Thread Matthew Clapp
Change by Matthew Clapp : -- keywords: +patch pull_requests: +25250 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26663 ___ Python tracker <https://bugs.python.org/issu

[issue44388] venv API Docs for EnvBuilder.ensure_directories incorrectly describe behavior

2021-06-11 Thread Matthew Clapp
Matthew Clapp added the comment: To clarify my intent: I'd really love a way to get the paths info from context from an existing native venv without affecting the directories of the venv. It seems like this is what ensure_directories *actually* does if clear==False. I'm hoping

[issue44699] Simple regex appears to take exponential time in length of input

2021-07-21 Thread Matthew Barnett
Matthew Barnett added the comment: It's called "catastrophic backtracking". Think of the number of ways it could match, say, 4 characters: 4, 3+1, 2+2, 2+1+1, 1+3, 1+2+1, 1+1+2, 1+1+1+1. Now try 5 characters... -- ___ Python

[issue44745] Manual for python 3.9.6 will not let me search

2021-07-26 Thread Matthew Zielinski
New submission from Matthew Zielinski : The Manual for python 3.9.6 always says there are no entries. I searched things it definitely had, like modules, but it said there were no topics found. -- components: Library (Lib) files: Python Error.png messages: 398261 nosy: matthman2019

[issue41254] Add to/from string methods to datetime.timedelta

2021-07-30 Thread Matthew Kenigsberg
Matthew Kenigsberg added the comment: I think it would be nice to have a from str method that could reverse the behavior of str(timedelta). I'm trying to parse files that contain the output of str(timedelta), and there's no easy way to get them back to timedelta's

[issue45155] Add default arguments for int.to_bytes()

2021-09-13 Thread Matthew Barnett
Matthew Barnett added the comment: I'd probably say "In the face of ambiguity, refuse the temptation to guess". As there's disagreement about the 'correct' default, make it None and require either "big" or "little" if lengt

[issue45155] Add default arguments for int.to_bytes()

2021-09-13 Thread Matthew Barnett
Matthew Barnett added the comment: I wonder whether there should be a couple of other endianness values, namely, "native" and "network", for those cases where you want to be explicit about it. If you use "big" it's not clear whether that's because you

[issue45461] UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 8191: \ at end of string

2021-10-13 Thread Matthew Barnett
Matthew Barnett added the comment: It can be shortened to this: buffer = b"a" * 8191 + b"\\r\\n" with open("bug_csv.csv", "wb") as f: f.write(buffer) with open("bug_csv.csv", encoding="unicode_escape", newline="") as

[issue45539] Negative lookaround assertions sometimes leak capture groups

2021-10-21 Thread Matthew Barnett
Matthew Barnett added the comment: It's definitely a bug. In order for the pattern to match, the negative lookaround must match, which means that its subexpression mustn't match, so none of the groups in that subexpression have captured. -- versions: +P

[issue45869] Unicode and acii regular expressions do not agree on ascii space characters

2021-11-22 Thread Matthew Barnett
Matthew Barnett added the comment: For comparison, the regex module says that 0x1C..0x1F aren't whitespace, and the Unicode property White_Space ("\p{White_Space}" in a pattern, where supported) also says that they ar

[issue45899] NameError on if clause of class-level list comprehension

2021-11-25 Thread Matthew Barnett
Matthew Barnett added the comment: It's not just in the 'if' clause: >>> class Foo: ... a = ['a', 'b'] ... b = ['b', 'c'] ... c = [b for x in a] ... Traceback (most recent call last): File "", line 1, i

[issue38764] Deterministic globbing.

2019-11-11 Thread Matthew Barnett
Matthew Barnett added the comment: I could also add: would sorting be case-sensitive or case-insensitive? Windows is case-insensitive, Linux is case-sensitive. -- nosy: +mrabarnett ___ Python tracker <https://bugs.python.org/issue38

[issue38974] using filedialog.askopenfilename() freezes python 3.8

2019-12-04 Thread Matthew Barnett
Matthew Barnett added the comment: I've just tried it on Windows 10 with Python 3.8 64-bit and Python 3.8 32-bit without issue. -- nosy: +mrabarnett ___ Python tracker <https://bugs.python.org/is

[issue39201] Threading.timer leaks memory in 3.8.0/3.8.1

2020-01-03 Thread Matthew Smith
Matthew Smith added the comment: This issue also affects me, pyth. I tried it out with various combinations of sleep, and durations of tasks, but what I noticed is that threading_shutdown_locks continues to grow at each iteration. for i in range(10): for j in range(10

[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-10 Thread Matthew Newville
New submission from Matthew Newville : We have a library (https://github.com/pyepics/pyepics) that wraps several C structures for a communication protocol library that involves many C->Python callbacks. One of the simpler structures we wrap with ctypes is defined with typedef str

[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-12 Thread Matthew Newville
Matthew Newville added the comment: Thanks for the reply and the fix -- I have not tried the master branch, but will try to do that soon. If I understand correctly, we will have to stick with our kludgy "workaround" version in order to work with Python 3.7.6 and 3.8.1. Or is ther

[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-13 Thread Matthew Newville
Matthew Newville added the comment: So, again, I'm trying to understand what the best workaround for this change is. I asked "can this workaround be improved" twice and got no reply, while getting plenty of responses to questions about the development process. I take this t

[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-14 Thread Matthew Newville
Matthew Newville added the comment: @eryksun Sorry for the imprecision -- I was mixing what we do on Linux and Windows. A minimum verifiable example for Linux/MacOS would be import ctypes class bitstruct(ctypes.Structure): _fields_ = [('addr', cty

[issue3770] test_multiprocessing fails on systems with HAVE_SEM_OPEN=0

2020-01-19 Thread Matthew Fernandez
Matthew Fernandez added the comment: I'm trying to follow the history of this issue, as it does not seem fully resolved to me. While trying to package something for Debian, one of the buildd [0] logs for hurd-i386 points to this issue as the cause of a failure [1]. This occurs with P

[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Matthew Barnett
Matthew Barnett added the comment: Python floats have 53 bits of precision, so ints larger than 2**53 will lose their lower bits (assumed to be 0) when converted. -- nosy: +mrabarnett resolution: -> not a bug ___ Python tracker <

[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Matthew Barnett
Change by Matthew Barnett : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue39436> ___ ___ Python-bugs-list

[issue38826] Regular Expression Denial of Service in urllib.request.AbstractBasicAuthHandler

2020-03-03 Thread Matthew Barnett
Matthew Barnett added the comment: A smaller change to the regex would be to replace the "(?:.*,)*" with "(?:[^,]*,)*". I'd also suggest using a raw string instead: rx = re.compile(r'''(?:[^,]*,)*[ \t]*([^ \t]+)[ \t]+realm=(["']?)(

[issue40027] re.sub inconsistency beginning with 3.7

2020-03-20 Thread Matthew Barnett
Matthew Barnett added the comment: Duplicate of Issue39687. See https://docs.python.org/3/library/re.html#re.sub and https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api. -- resolution: -> duplicate stage: -> resolved status: open -&g

[issue40043] RegExp Conditional Construct (?(id/name)yes-pattern|no-pattern) Problem

2020-03-22 Thread Matthew Barnett
Matthew Barnett added the comment: The documentation is talking about whether it'll match at the current position in the string. It's not a bug. -- resolution: -> not a bug ___ Python tracker <https://bugs.pytho

[issue40043] RegExp Conditional Construct (?(id/name)yes-pattern|no-pattern) Problem

2020-03-26 Thread Matthew Barnett
Matthew Barnett added the comment: That's what searching does! Does the pattern match here? If not, advance by one character and try again. Repeat until a match is found or you've reached the end. -- ___ Python tracker <https://bu

[issue40359] email.parse part.get_filename() fails to unwrap long attachment file names

2020-04-21 Thread Matthew Davis
New submission from Matthew Davis : # Summary When parsing emails with long attachment file names, part.get_filename() often returns \n or \r\n. It should strip those characters out. # Steps to reproduce I have attached a minimal working example. The relevant part of the raw email is

[issue40359] email.parse part.get_filename() fails to unwrap long attachment file names

2020-04-21 Thread Matthew Davis
Matthew Davis added the comment: Ah woops, I mistyped the relevant ticket. It's issue 36401 https://bugs.python.org/issue36041 -- ___ Python tracker <https://bugs.python.org/is

[issue40359] email.parse part.get_filename() fails to unwrap long attachment file names

2020-04-21 Thread Matthew Davis
Matthew Davis added the comment: 36041 -- ___ Python tracker <https://bugs.python.org/issue40359> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40359] email.parse part.get_filename() fails to unwrap long attachment file names (legacy API)

2020-04-27 Thread Matthew Davis
Matthew Davis added the comment: Ah, yes that workaround works. Thanks! So what's the exact status of this policy? It's called the default policy, but it's not used by default? If I download the latest version of python, will this be parsed correctly without explicitly set

[issue42551] Generator `yield`s counted as primitive calls by cProfile

2020-12-02 Thread Matthew Suozzo
New submission from Matthew Suozzo : # Issue When profiling a generator function, the initial call and all subsequent yields are aggregated into the same "ncalls" metric by cProfile. ## Example >>> cProfile.run(""" ... def foo(): ... yield 1 ... yield

[issue42633] Wave documentation doesn't mention signed/unsigned requirements

2020-12-13 Thread Matthew Walker
New submission from Matthew Walker : It would be very useful if the documentation for Python's Wave module mentioned that 8-bit samples must be unsigned while 16-bit samples must be signed. See the Wikipedia article on the WAV format: "There are some inconsistencies in the WAV f

[issue42551] Generator `yield`s counted as primitive calls by cProfile

2020-12-14 Thread Matthew Suozzo
Matthew Suozzo added the comment: One of the problems with my proposed solution that I glossed over was how and where to count the primitive call. If the primitive call is only registered on RETURN (i.e. after all yields), a generator that is incompletely exhausted would have 0 primitive

[issue42668] re.escape does not correctly escape newlines

2020-12-17 Thread Matthew Barnett
Matthew Barnett added the comment: In a regex, putting a backslash before any character that's not an ASCII-range letter or digit makes it a literal. re.escape doesn't special-case control characters. Its purpose is to make a string that might contain metacharacters into on

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett
Matthew Barnett added the comment: It's not a crash. It's complaining that you're referring to group 2 before defining it. The re module doesn't support forward references to groups, but only backward references to them. -- __

[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Matthew Barnett
Matthew Barnett added the comment: Example 1: ((a)|b\2)* ^^^ Group 2 ((a)|b\2)* ^^ Reference to group 2 The reference refers backwards to the group. Example 2: (b\2|(a))* ^^^ Group 2 (b\2|(a))* ^^ Reference to group 2

[issue43156] Python windows installer has a confusing name - add setup to its name

2021-02-07 Thread Matthew Barnett
Matthew Barnett added the comment: Sorry to bikeshed, but I think it would be clearer to keep the version next to the "python" and the "setup" at the end: python-3.10.0a5-win32-setup.exe python-3.10.0a5-win64-setup.exe

[issue43224] Add support for PEP 646 (Variadic Generics) to typing.py

2021-02-14 Thread Matthew Rahtz
Change by Matthew Rahtz : -- components: Library (Lib) nosy: mrahtz priority: normal severity: normal status: open title: Add support for PEP 646 (Variadic Generics) to typing.py versions: Python 3.10 ___ Python tracker <https://bugs.python.

[issue43224] Add support for PEP 646 (Variadic Generics) to typing.py

2021-02-14 Thread Matthew Rahtz
Change by Matthew Rahtz : -- keywords: +patch nosy: +matthew.rahtz nosy_count: 1.0 -> 2.0 pull_requests: +23313 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24527 ___ Python tracker <https://bugs.p

[issue43322] Inconsistent '#include' notation in extensions tutorial doc

2021-02-25 Thread Matthew Hughes
New submission from Matthew Hughes : Just a small thing in these docs, there is a mix of "#include ", e.g. https://github.com/python/cpython/blame/master/Doc/extending/newtypes_tutorial.rst#L243 and '#include "structmember.h"', mostly in the included samples e

[issue43340] json.load() can raise UnicodeDecodeError, but this is not documented

2021-02-27 Thread Matthew Woodcraft
New submission from Matthew Woodcraft : The documentation for json.load() and json.loads() says: « If the data being deserialized is not a valid JSON document, a JSONDecodeError will be raised. » But this is not currently entirely true: if the data is provided in bytes form and is not

[issue40844] Alternate ways of running coroutines

2020-06-02 Thread Matthew Francis
New submission from Matthew Francis <4576fran...@gmail.com>: Currently, using await inside a coroutine will block inside the coroutine. This behavior would usually be fine, but for some usecases a way to nonblockingly run coroutines without creating a Task could be useful, because

[issue40827] os.readlink should support getting the target's printname in Windows

2020-06-15 Thread Matthew Lovell
Change by Matthew Lovell : -- nosy: +mattblovell ___ Python tracker <https://bugs.python.org/issue40827> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes
New submission from Matthew Hughes : While investigating Python's SSL I noticed there was no interface for interacting with OpenSSL's SSL_CTX_{get,set}_security_level (https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html) so I thought I'd look into

[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes
Matthew Hughes added the comment: > Applications should not change this setting > A read-only getter for the policy sounds like a good idea, though. Thanks for the feedback, sounds reasonable to me. I'll happily work on getting a PR up for the read-

[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes
Change by Matthew Hughes : -- pull_requests: +20431 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21282 ___ Python tracker <https://bugs.python.org/issu

[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-03 Thread Matthew Hughes
Matthew Hughes added the comment: I noticed this test was still emitting a "ResourceWarning": -- $ ./python -m test test_ssl -m TestPostHandshakeAuth 0:00:00 load avg: 0.74 Run tests sequentially 0:00:00 load avg:

[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-03 Thread Matthew Hughes
Matthew Hughes added the comment: Whoops, I realise the patch I shared contained a combination of two (independent) approaches I tried: 1. Add sleep and perform cleanup 2. Naively patch catch_threading_exception to accept a cleanup routine to be run upon exiting but before removing the

[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-08 Thread Matthew Hughes
Change by Matthew Hughes : -- pull_requests: +20541 pull_request: https://github.com/python/cpython/pull/21393 ___ Python tracker <https://bugs.python.org/issue37

[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes
New submission from Matthew Hughes : >>> import argparse >>> parser = argparse.ArgumentParser(exit_on_error=False) >>> parser.parse_args(["--unknown"]) usage: [-h] : error: unrecognized arguments: --unknown The docs https://docs.python.o

[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes
Matthew Hughes added the comment: > typo in the docs that it should have used enabled instead of enable Well spotted, I'll happily fix this up. > I guess the docs by manually mean that ArgumentError will be raised when > exit_on_error is False that can be handled. To be clear

[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes
Matthew Hughes added the comment: I've attached a patch containing tests showing the current behavior, namely that exit_on_error does not change the behavior of argparse.ArgumentParser.parse_args in either case: * An unrecognized option is given * A required option is not given Shoul

[issue29056] logging.Formatter doesn't respect more than one formatException()

2020-07-21 Thread Matthew Davis
Matthew Davis added the comment: The documentation says "you will have to clear the cached value" What does that mean? How do I clear the cached value? Is there a flush function somewhere? Do I `del` the attribute? Set the attribute to None? The documentation as it stands toda

[issue41531] Python 3.9 regression: Literal dict with > 65535 items are one item shorter

2020-08-12 Thread Matthew Barnett
Matthew Barnett added the comment: I think what's happening is that in 'compiler_dict' (Python/compile.c), it's checking whether 'elements' has reached a maximum (0x). However, it's not doing this after incrementing; instead, it's checking before i

[issue41664] re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used

2020-08-29 Thread Matthew Barnett
Matthew Barnett added the comment: The 4th argument of re.sub is 'count', not 'flags'. re.IGNORECASE has the numeric value of 2, so: re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE) is equivalent to: re.sub(r&#

[issue41764] sub function would not work without the flags but the search would work fine

2020-09-11 Thread Matthew Barnett
Matthew Barnett added the comment: The arguments are: re.sub(pattern, repl, string, count=0, flags=0). Therefore: re.sub("pattern","replace", txt, re.IGNORECASE | re.DOTALL) is passing re.IGNORECASE | re.DOTALL as the count, not the flags. It's in the document

[issue41788] enhancement: add assertDuration context manager to unittest module

2020-09-14 Thread Matthew Davis
New submission from Matthew Davis : # Summary I propose an additional unit test type for the unittest module. TestCase.assertDuration(min=None, max=None), which is a context manager, similar to assertRaises. It runs the code inside it, and then fails the test if the duration of the code

[issue41885] Unexpected behavior re.sub() with raw f-strings

2020-09-29 Thread Matthew Barnett
Matthew Barnett added the comment: Arguments are evaluated first and then the results are passed to the function. That's true throughout the language. In this instance, you can use \g<1> in the replacement string to refer to group 1: re.sub(r'([a-z]+)', fr"\g<

[issue42353] Proposal: re.prefixmatch method (alias for re.match)

2020-11-14 Thread Matthew Suozzo
Matthew Suozzo added the comment: > It just won't work unless you add explicit ".*" or ".*?" at the start of the > pattern But think of when regexes are used for validating input. Getting it to "just work" may be over-permissive validation that o

[issue42473] re.sub ignores flag re.M

2020-11-26 Thread Matthew Barnett
Matthew Barnett added the comment: Not a bug. Argument 4 of re.sub is the count: sub(pattern, repl, string, count=0, flags=0) not the flags. -- nosy: +mrabarnett resolution: -> not a bug stage: -> resolved status: open -> closed _

[issue42475] wrongly cache pattern by re.compile

2020-11-26 Thread Matthew Barnett
Matthew Barnett added the comment: That behaviour has nothing to do with re. This line: samples = filter(lambda sample: not pttn.match(sample), data) creates a generator that, when evaluated, will use the value of 'pttn' _at that time_. However, you then bind 'pttn

[issue13899] re pattern r"[\A]" should work like "A" but matches nothing. Ditto B and Z.

2012-02-03 Thread Matthew Barnett
Matthew Barnett added the comment: This should answer that question: >>> re.findall(r"[\A\C]", r"\AC") ['C'] >>> regex.findall(r"[\A\C]", r"\AC") ['A', 'C

[issue13899] re pattern r"[\A]" should work like "A" but matches nothing. Ditto B and Z.

2012-02-04 Thread Matthew Barnett
Matthew Barnett added the comment: In re, "\A" within a character set should be similar to "\C", but instead it's still interpreted as meaning the start of the string. That's definitely a bug. If it doesn't do what it's supposed to do, then it's a

[issue13995] sqlite3 Cursor.rowcount documentation for old sqlite bug

2012-02-11 Thread Matthew Woodcraft
New submission from Matthew Woodcraft : The documentation for the sqlite3 module contains the following statement, under 'Cursor.rowcount': For DELETE statements, SQLite reports rowcount as 0 if you make a DELETE FROM table without any condition. This doesn't happen for

[issue13998] Lookbehind assertions go behind the start position for the match

2012-02-13 Thread Matthew Barnett
Matthew Barnett added the comment: The documentation says of the 'pos' parameter "This is not completely equivalent to slicing the string" and of the 'endpos' parameter "it will be as if the string is endpos characters long". In other words, it st

[issue14160] Tarfile.extractfile fails to extract targets of top-level relative symlinks

2012-02-29 Thread Matthew Miller
New submission from Matthew Miller : I have a tarfile with relative paths. The tail of tar tvf looks like this: -rw-r--r-T nobody/nobody 1356 2012-02-28 19:25 s/772 -rw-r--r-- nobody/nobody 1304 2012-02-28 19:25 s/773 -rw-r--r-- nobody/nobody 1304 2012-02-28 19:25 s/774 -rw-r--r-- nobody

[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2012-02-29 Thread Matthew Barnett
Matthew Barnett added the comment: Ideally, it should raise an exception (or a warning) because the behaviour is unexpected. -- ___ Python tracker <http://bugs.python.org/issue13

[issue14164] my little contribution to the docs

2012-03-01 Thread Matthew Johnson
Matthew Johnson added the comment: I think he's right to fix those "mistakes". Just see the first sentence @ http://docs.python.org/tutorial/floatingpoint.html#floating-point-arithmetic-issues-and-limitations It reads: "Floating-point numbers are represented in [...]

[issue14160] TarFile.extractfile fails to extract targets of top-level relative symlinks

2012-03-01 Thread Matthew Miller
Changes by Matthew Miller : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue14160> ___ ___ Python-bugs-list mailing list Unsubscri

<    1   2   3   4   5   6   7   8   9   >