[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

2022-04-03 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue47185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47154] -arch detection in _osx_support generates false positives

2022-03-29 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue47154>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47152] Reorganize the re module sources

2022-03-29 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

Could the sre_parse and sre_constants modules be kept with public names (i.e. 
without the leading underscore) but within the re namespace? I use them to 
tokenize and then syntax highlight regular expressions.

I did a quick search and found a few other users of the modules:

* pydoctor uses them for regex syntax highlighting[1], although it has its own 
copy of the sre_parse source rather than importing from stdlib.
* lark uses sre_parse to find minimum and maximum length of matching strings[2]
* sre_yield uses them to determine all strings that will match a regex[3]

The whole modules don't necessarily need exposing, but certainly 
sre_parse.parse, sre_parse.parse_template, and the opcodes from sre_constants 
would be the most useful.


[1] 
https://github.com/twisted/pydoctor/blob/c86273dffade5455890570142c8b7b068f5dffd1/pydoctor/epydoc/markup/_pyval_repr.py#L776
[2] 
https://github.com/lark-parser/lark/blob/85ea92ebf4e983e9997f9953a9c1463bb3d1c6cc/lark/utils.py#L120
[3] 
https://github.com/google/sre_yield/blob/3af063a0054c4646608b43b941fbfcbe4e01214a/sre_yield/__init__.py

--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue47152>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40059] Provide a toml module in the standard library

2022-03-09 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +domdfcoding
nosy_count: 18.0 -> 19.0
pull_requests: +29889
pull_request: https://github.com/python/cpython/pull/31784

___
Python tracker 
<https://bugs.python.org/issue40059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40059] Provide a toml module in the standard library

2022-03-09 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

When building Python from source (as of the latest GitHub commit) the tomllib 
directory doesn't actually get copied over to the install prefix.

It looks like an entry's needed in Makefile.pre.in under LIBSUBDIRS, along the 
lines of https://github.com/python/cpython/pull/13563 and 
https://github.com/python/cpython/pull/30311

--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue40059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46736] Generate HTML 5 with SimpleHTTPRequestHandler.list_directory

2022-02-13 Thread Dominic Davis-Foster


New submission from Dominic Davis-Foster :

Currently SimpleHTTPRequestHandler.list_directory (which is used with `python3 
-m http.server` amongst other things) generates HTML with the doctype:

http://www.w3.org/TR/html4/strict.dtd;>

i.e. HTML 4.01.


I propose making the generated page HTML 5 instead. The only necessary change 
is in the doctype; the rest of the page is valid already. HTML 5 has been 
supported by Chrome, Firefox, Safari and Opera since 2013, and Edge since 2015 
so there shouldn't be any issues with browser compatibility.

The generated page has been HTML 4.01 since https://bugs.python.org/issue13295 
in 2011, where it was originally proposed to switch to HTML 5.


Switching to HTML 5 would also allow http.server to be used to serve a simple 
index for pip that's compliant with PEP 503.

There's some discussion in https://github.com/pypa/pip/issues/10825

--
components: Library (Lib)
messages: 413173
nosy: dom1310df
priority: normal
severity: normal
status: open
title: Generate HTML 5 with SimpleHTTPRequestHandler.list_directory
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46736>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45391] 3.10 objects.inv classifies UnionType as data

2021-10-23 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue45391>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43838] There is a way to access an underlying mapping in MappingProxyType

2021-07-23 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue43838>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39846] Register .whl as a unpack format in shutil unpack

2021-06-30 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

I have run into this myself and was surprised unpack_archive didn't support 
wheels. I would like to see support added, and don't mind doing the work myself.

That said, I can see there being an issue with the number of supported 
zip-based formats ballooning: Java JARs, Android APKs etc.
However, wheels have a use case for easily extracting them -- that's how 
they're installed. I can't see a use case for being able to *easily* extract 
other formats.

If there's no opposition I will start work on a PR.

--
nosy: +domdfcoding
versions: +Python 3.11 -Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue39846>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44353] PEP 604 NewType

2021-06-10 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

It is possible to implement NewType to return a class rather than a function as 
it does currently. However, the class version uses substantially more memory 
(1072 bytes vs 144 bytes with sys.getsizeof) and NewType is supposed to have 
almost no runtime overhead.

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue44353>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44297] Frame with -1 line number

2021-06-06 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

Is this a re-regression of https://bugs.python.org/issue43933?

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue44297>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44277] cpython forks are spammed with dependabot PRs

2021-06-02 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

There's an open issue on GitHub, but it hasn't gone anywhere.

https://github.com/dependabot/dependabot-core/issues/2804

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue44277>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44246] 3.10 beta 1: breaking change in importlib.metadata entry points

2021-05-28 Thread Dominic Davis-Foster


Change by Dominic Davis-Foster :


--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue44246>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44084] Can't mark match, case, _ as keywords in docs

2021-05-09 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

I'm not sure this is a Pygments or Sphinx bug. The documentation for the 
:keyword: role[1] says:

   This creates a link to a reference label with that name, if it exists.


Looking at the documentation source for "Compound statements"[2] each section 
for a particular keyword is preceded by a reference label for the relevant 
keyword(s).

So for "match" and "case" all that's needed is to put the label before the 
section of the docs talking about them.
In fact, it seems that "match" does have a label[3], and I can link to it 
successfully; it's just "case" and "_" that don't work

"_" is more tricky, as you can't have a reference label called that. However, 
if you pick another name for the label (say, "underscore") you can use that as 
the target name and still have "_" as the text like so:

:keyword:`_ `


[1] 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-keyword
[2] 
https://raw.githubusercontent.com/python/cpython/main/Doc/reference/compound_stmts.rst
[3] 
https://github.com/python/cpython/blame/main/Doc/reference/compound_stmts.rst#L514

--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue44084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42059] TypedDict(...) as function does not respect "total" when setting __required_keys__ and __optional_keys__

2021-04-12 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

I have backported this to typing_extensions in 
https://github.com/python/typing/pull/778

On Python 3.9.2 and above typing.TypedDict is used, otherwise it's 
typing_extensions.TypedDict.

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue42059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43624] Add underscore as a decimal separator for string formatting

2021-03-25 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

ISO 8-1:2009 recommends groups of three digits either side of the decimal 
sign.

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue43624>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

Paul's example with the embedded null no longer works on Python 3.8 as 
Path.exists returns False on ValueError (added in gh-7695)

Path.exists already ignores some Windows-specific errors, so I don't see why it 
shouldn't also ignore invalid paths which can't exist.

--
nosy: +domdfcoding2

___
Python tracker 
<https://bugs.python.org/issue42855>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41907] Regression in IntFlag behaviour in f-string

2020-10-02 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

I believe the regression is due to GH-14545 which "fixed" bpo-37479. The news 
entry states:

"When `Enum.__str__` is overridden in a derived class, the override will be 
used by `Enum.__format__` regardless of whether mixin classes are present."

.

The change is in the __format__ method of Enum. It now checks if 
type(self).__str__ != Enum.__str__ and if True calls str(self). Because Flag 
defines its own __str__ method, the expression evaluates to True. I do not 
think this is the indented behaviour.

In 3.8.5 str(self) was only called if _member_type_ is object.

--
nosy: +dom1310df

___
Python tracker 
<https://bugs.python.org/issue41907>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41824] Docs for typing.ForwardRef don't state that is was added in 3.7

2020-09-21 Thread Dominic Davis-Foster


New submission from Dominic Davis-Foster :

typing.ForwardRef was first documented in GH-14216 but there's no mention that 
the class was only added in Python 3.7.

In Python 3.6 there's no typing.ForwardRef; there is a typing._ForwardRef which 
seems to be the same thing from before it was made public.


What I don't know is whether the change of name was made in 3.7 or in a point 
release.

--
components: Library (Lib)
messages: 377262
nosy: dom1310df
priority: normal
severity: normal
status: open
title: Docs for typing.ForwardRef don't state that is was added in 3.7
versions: Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue41824>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41232] Python `functools.wraps` doesn't deal with defaults correctly

2020-08-05 Thread Dominic Davis-Foster


Dominic Davis-Foster  added the comment:

To me your examples seem like a misuse of functools.wraps. IIUC its purpose is 
to make a wrapper that accepts solely *args and **kwargs appear to be the 
wrapped function; it doesn't seem to be intended to be used when the wrapper 
takes arguments of different types or that have different default values. 

I can't think of a situation where you'd use wraps with a decorator that 
doesn't take just *args and **kwargs. That's not to say there aren't occasions 
where you'd want to to that, just that wraps isn't the right tool.

--
nosy: +domdfcoding

___
Python tracker 
<https://bugs.python.org/issue41232>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com