[issue13299] namedtuple row factory for sqlite3

2021-08-05 Thread Zaur Shibzukhov


Zaur Shibzukhov  added the comment:

Instead of using cache, maybe better to use mutable default argument?

For example:

def make_row_factory(cls_factory, **kw):
def row_factory(cursor, row, cls=[None]):
rf = cls[0]
if rf is None:
fields = [col[0] for col in cursor.description]
cls[0] = cls_factory("Row", fields, **kw)
return cls[0](*row)
return rf(*row)
return row_factory

namedtuple_row_factory = make_row_factory(namedtuple)

Seem it should add less overhead.

--
nosy: +intellimath

___
Python tracker 

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



[issue44822] [sqlite3] Do not truncate results of user functions and aggregates on the first NUL

2021-08-05 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +26105
pull_request: https://github.com/python/cpython/pull/27611

___
Python tracker 

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



[issue44822] [sqlite3] Do not truncate results of user functions and aggregates on the first NUL

2021-08-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 8f010dc920e1f6dc6a357e7cc1460a7a567c05c6 by Erlend Egeberg 
Aasland in branch 'main':
bpo-44822: Don't truncate `str`s with embedded NULL chars returned by `sqlite3` 
UDF callbacks (GH-27588)
https://github.com/python/cpython/commit/8f010dc920e1f6dc6a357e7cc1460a7a567c05c6


--

___
Python tracker 

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



[issue44817] os.path.realpath fails with WinError 161

2021-08-05 Thread Michael Förderer

Michael Förderer  added the comment:

Done.

--

___
Python tracker 

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



[issue44828] Using tkinter.filedialog crashes on macOS Python 3.9.6

2021-08-05 Thread Nythepegasus

Nythepegasus  added the comment:

I used brew.sh to install Python, which I think uses the universal installer 
(although I can’t check, reinstalling macOS after hours of failing to downgrade 
back to Big Sur). I can’t remember the exact error, but it seemed to be from 
Apple’s end since it complained about not having access to the save/open dialog 
box. After I reinstall macOS, if you need further testing, i’m open to trying.
On Aug 4, 2021, 2:53 PM -0400, E. Paine , wrote:
>
> E. Paine  added the comment:
>
> Thanks for reporting issue and for including the backtrace. I presume you 
> used the Universal 2 installer, given that you are running an M1 mac?
>
> Kevin, do you have access to the macOS 12 beta to help test whether this is a 
> Tkinter or Tk bug? (I assume the latter, as it is likely Apple have changed 
> the API again)
>
> --
> components: +macOS
> nosy: +epaine, ned.deily, ronaldoussoren, serhiy.storchaka, wordtech
>
> ___
> Python tracker 
> 
> ___

--
title: Using tkinter.filedialog crashes on macOS 12 Monterey beta 4 with 
tk8.6.11 from python.org installers -> Using tkinter.filedialog crashes on 
macOS Python 3.9.6

___
Python tracker 

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



[issue42524] [doc] pdb access to return value

2021-08-05 Thread Romuald Brunet


Change by Romuald Brunet :


--
pull_requests: +26106
pull_request: https://github.com/python/cpython/pull/27612

___
Python tracker 

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



[issue41103] Removing old buffer support

2021-08-05 Thread Petr Viktorin


Petr Viktorin  added the comment:

These should be removed from the *limited API*, but stay for the stable ABI.
(PEP 652 mentions this can happen but doesn't give details, which will be a bit 
tricky. These are good candidates for figuring out the process.)

I assigned this to myself; I'll try to get to it for 3.11.


> What is the benefit of removing this? Is copy pasting the compatibility layer 
> to (possibly many) different projects worth the "cleanup"?

Yes. PyObject_AsReadBuffer is dangerous *in general*, but in certain specific 
cases where you're relying on CPython implementations details it can work. For 
example, borrowing a buffer from a *string* or *array* will work on CPython, 
and I don't see that changing any time soon. So, using PyObject_AsReadBuffer is 
still tech debt, but for some projects that's OK.

All this should be documented in the release notes, though, so the projects 
know what they're doing. (And the release notes should be written *with the 
change*, not later, so projects testing early can read them.)

--
assignee:  -> petr.viktorin
nosy: +petr.viktorin
status: closed -> open

___
Python tracker 

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



[issue44836] shutil _unpack_zipfile filename encoding issue

2021-08-05 Thread Yogendra kumar soni

New submission from Yogendra kumar soni :

shutil _unpack_zipfile uses takes filename using 
name = info.filename 
if files are created in a machine that uses different encoding say utf-8 
containing u'\u201c' in filename and the machine where we are extracting has a 
different encoding say Latin-1.
creating target path using ​_ensure_directory(targetpath)
​is not  able to correctly check target path and creating targetpath also fails.
UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c'.

--
components: Library (Lib)
messages: 398975
nosy: yogendraksoni
priority: normal
severity: normal
status: open
title: shutil _unpack_zipfile  filename encoding issue
type: enhancement

___
Python tracker 

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



[issue44749] LOAD_NAME not using PyObject_GetItem when globals() is a dict subclass

2021-08-05 Thread Douglas Raillard


Douglas Raillard  added the comment:

I ended up with a slightly different API that allows me to preemptively set 
some global names before the code runs in the module, so my use case sort of 
vanished. I don't think there is a real need of beating the dead horse here.

My only suggestion on the topic is that since the feature is not documented and 
is not really usable anyway, we might as well remove the slow path in 
LOAD_GLOBAL (unless there is a use case for having LOAD_GLOBAL and not 
LOAD_NAME I'm missing)

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread krey


New submission from krey :

From: https://docs.python.org/3/library/os.html

os.symlink(src, dst, target_is_directory=False, *, dir_fd=None)

Create a symbolic link pointing to `src` named `dst`.

It's a bit like saying

find(needle, haystack)

Finds `haystack` in `needle`

If you look at the manpage ln, it says
ln [OPTION]... [-T] TARGET LINK_NAME

So os.symlink isn't consistent with ln

--
assignee: docs@python
components: Documentation
messages: 398977
nosy: docs@python, krey
priority: normal
severity: normal
status: open
title: os.symlink arg names are bad
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-05 Thread STINNER Victor

STINNER Victor  added the comment:

I don't see the benefit of the PR 27527. "BaseFilter" contains "Base" in its 
name and its only *private* method raises NotImplementedError. Maybe my design 
mistake (I wrote the tracemalloc module) was to expose it in the first place.

I suggest to leave the code as it is. As Łukasz wrote, there are other stdlib 
modules using "base" or "abstract" classes without using the abc module.

--
nosy: +vstinner

___
Python tracker 

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



[issue44301] Is there a way to provide destructor for module written using C API?

2021-08-05 Thread Petr Viktorin

Petr Viktorin  added the comment:

I see that I wrote "counts" rather than "cycles" before; that line should be:

   The clear function is used to break reference cycles. In this case, there 
are no reference cycles to be broken, so it is not called.



Thanks to Pablo for the review & Łukasz for the merges!

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

There is nothing wrong with saying

Create a symbolic link pointing to `src` named `dst`.

That is grammatically correct English.

We could say "create a sym link called dst pointing to src" but they mean 
exactly the same thing. And given that the order of parameters is src first and 
dst second, it makes more sense to keep the same order in the description.

Your analogy with

Finds `haystack` in `needle`

is not correct. The analogy would be 


find(needle, haystack)
-> Finds `needle` in `haystack`
-> or search haystack for needle

os.symlink(src, dst)
-> create symlink pointing to source called dst
-> or create symlink called dst pointing to src


The order of arguments is the same as for ln:

ln [OPTION]... [-T] TARGET LINK_NAME

TARGET is src, LINK_NAME is dst.


I don't think that there is anything needed to be done here.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread krey


krey  added the comment:

OK, let's ignore the analogy.

Everywhere else I've seen, arrows (or directed edges in a graph) point as
SOURCE -> TARGET
SOURCE -> DESTINATION
(TARGET and DESTINATION are synonymous in this context)
An example from math: 
https://en.wikipedia.org/wiki/Category_(mathematics)#Definition

ln has two arguments, LINKNAME and TARGET, so it's implied that
LINKNAME -> TARGET
In fact that's exactly what you see visually when you run ls -l

In os.symlink, however, you have
SRC <- DST
which is weird. I agree that this weirdness is explained in grammatically 
correct English.

Just because it's the first argument, we shouldn't call it src. The arg 
ordering is already confusing enough 
https://unix.stackexchange.com/questions/541795/tips-for-remembering-the-order-of-parameters-for-ln

--

___
Python tracker 

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-05 Thread Anton Grübel

Anton Grübel  added the comment:

Even it is a private method, it is essential, when you use 
Snapshot.filter_traces(). Creating a Filter without implementing this method 
will just result in a runtime error.

https://github.com/python/cpython/blob/029cb4a6adacb650dbfc8ea71d2875ab771fe92e/Lib/tracemalloc.py#L442-L451

For me it feels like a bad practice to just recommend the developer to 
implement this method instead of enforcing it. Why is there a possibility to 
state clearly that a class is an abstract class and not use it? Even PEP20 
states, "Explicit is better than implicit."

So why is there a way to create an abstract class in Python, just for fun? I 
don't think so, it is to make the intent very clear. As said, there is probably 
a lot of old code laying around in Python, which could be modernized by using 
functionality of newer Python versions, so why not change it? Is there actually 
any drawback in defining this class as an abstract class or do you actually 
gain more, because everyone directly understands that an abstract method has to 
be implemented in the subclass.

@Lukasz: if you ask me, I would change all of them, but I'm definitely lacking 
the skill and experience to find all those flaws and fix them. I'm happy to 
help and for me making code better even it is small is always appreciated, if 
you always think it is not worth the trouble or nothing really to gain, then it 
will stay that way and more and more of those constructs will arise. In Germany 
we have a saying, small cattle also make muck :D

But thanks for taking a look, even it was not worth the trouble. I had fun  
creating the PR, but you can just do what you like with it.

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin


Ken Jin  added the comment:

> This PRs herein have created a situation wherein the 
> `__name__`/`__qualname__` attributes of certain typing objects can be `None`. 
> Is this behavior intentional?

The affected objects are special forms which can hold types, so Union[], 
TypeGuard[], and Concatenate[].

Personally, I don't really understand the meaning of __name__ for special 
forms. From the docs 
https://docs.python.org/3/library/stdtypes.html#definition.__name__, __name__ 
refers to "The name of the class, function, method, descriptor, or generator 
instance.". __name__ make sense for GenericAlias because it's supposed to be an 
almost transparent proxy to the original class (eg. typing.Callable -> 
collections.abc.Callable).  A special form is not really any one of those 
things listed in the docs (though I'm aware it's implemented using GenericAlias 
internally).

OTOH, Python's definition of a type and typing's are wildly different. Union[X, 
Y] is called a "Union type" (despite being an object), and all types ought to 
have __name__ ;).

@Lars, would it help your use case for Union[X, Y] and friends to have __name__ 
too? Note that this would mean the builtin union object (int | str) will need 
to support __name__ too. It looks a bit strange to me, but if it's useful I'm a 
+0.5 on this.

CC-ed Serhiy for his opinion too.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Order of arguments for ln:

ln -s SOURCE DESTINATION

Order of arguments for os.symlink:

os.symlink(SOURCE, DESTINATION)

They are exactly the same order.

> Everywhere else I've seen, arrows (or directed edges in a graph) point as
> SOURCE -> TARGET
> SOURCE -> DESTINATION

The source doesn't point to the symlink. The symlink points to the 
source.

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

@krey: What's your suggested change? We can change neither the parameter order 
nor parameter names without breaking code, so that won't happen.

You created this as a documentation issue. Do you have a suggested 
documentation change?

--
nosy: +eric.smith

___
Python tracker 

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



[issue44818] '\t' (tab) support

2021-08-05 Thread Pooia


Pooia  added the comment:

Got it, thanks!
Erlend E. Aasland:
> I'm guessing this has to do with mixing spaces and tabs when indenting
code. This can be fixed in your text editor

precisely! It's the problem.
Thank you I guess Python can't support tab but it sounds Gnu nano mix
spaces and tabs!

On Thu, Aug 5, 2021 at 2:56 AM Erlend E. Aasland 
wrote:

>
> Erlend E. Aasland  added the comment:
>
> I'm guessing this has to do with mixing spaces and tabs when indenting
> code. This can be fixed in your text editor.
>
> --
> nosy: +erlendaasland
> status: open -> pending
>
> ___
> Python tracker 
> 
> ___
>

--
status: pending -> open

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Bas van Beek


Bas van Beek  added the comment:

I do agree that it's nice to have a `__name__` for special forms, as they do 
very much behave like types even though they're strictly speaking not distinct 
classes.

Whether we should have this feature is a distinct "problem" from its `__name__` 
being `None` (as can happen in its the current implementation), 
the latter of which is actively breaking tests over in 
https://github.com/numpy/numpy/pull/19612.
I don't recall ever seeing a non-string name before, so I'd argue that this is 
a bug.

It seems to be easy to fix though (see below for a `Union` example), so if 
there are objections I'd like to submit a PR.

```
-return _UnionGenericAlias(self, parameters)
+return _UnionGenericAlias(self, parameters, name="Union")
```

--

___
Python tracker 

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



[issue44818] '\t' (tab) support

2021-08-05 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44818] '\t' (tab) support

2021-08-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> I guess Python can't support tab

AFAIK, it was a deliberate decision during the Python 2 => Python 3 transition.

> [...] it sounds Gnu nano mix spaces and tabs!

You can set up GNU nano to expand tabs:

$ echo "set tabstospaces" >> ~/.nanorc

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Andre Roberge


New submission from Andre Roberge :

Given the following code containing no if expression (only if statements):

if True:
print('hello'

if 2:
print(123))

The following traceback is generated in Python 3.10.0RC1

  File "...\example.py", line 2
print('hello'
  ^^^
SyntaxError: expected 'else' after 'if' expression

--
components: Parser
messages: 398989
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: SyntaxError: New message "expected 'else' after 'if' expression" wrongly 
shown
versions: Python 3.10

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread krey


krey  added the comment:

@eric.smith Sorry for tagging this as docs, wasn't sure what to pick. I guess 
it should be under Library 

Does CPython have a process for changing arg names via deprecation warnings?

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin


Ken Jin  added the comment:

@Bas van Beek, thanks for testing numpy on 3.10rc1 and sending that link over. 
I was confused about what your original question entailed. The link provided 
much more context :). Seems that __name__ = None unintentionally breaks things 
that use annotations to generate docstrings.

> I don't recall ever seeing a non-string name before, so I'd argue that this 
> is a bug.

Yes.

> Whether we should have this feature is a distinct "problem" from its 
> `__name__` being `None`

If we properly set __name__ for all typing special forms, it won't have this 
problem anymore right? So we can kill two birds with one stone :).

> I'd like to submit a PR.

Please do! I'm re-opening this issue. Thanks for informing us.

--
priority: normal -> high
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue20587] sqlite3 converter not being called

2021-08-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Closing as out-of-date. If anyone disagrees, please reopen :)

--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue21465] sqlite3 Row can return duplicate keys when using adapters

2021-08-05 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Closing this for now. If anyone disagrees, please reopen :)

--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Yes, we have a process:

- At least one full release with a pending deprecation warning (silent 
  by default); 3.11 is the earliest that could take place.
- At least one full release with an active deprecation warning; 3.12 
  would be the earliest for this.
- Make the change. 3.13 would be the earliest for this.

If the change is particularly urgent, we could skip the pending warning 
and bring it forward one release, but since this isn't a critical 
security bug that needs immediate action, 3.12 would be the absolute 
earliest we could make this change.

But it is vanishingly unlikely that we would change either the names of 
the parameters, or their order, without a really good reason.

You haven't given us any convincing justification for why we should 
make this change. The os.symlink function takes its arguments in exactly 
the same order as `ln -s` takes them: original source file first, 
symbolic link destination second. We're not likely to change the order 
to be the opposite to that used by `ln`.

Different Unixes and Linuxes already use different argument names for 
`ln`, we're not obliged to match any of them. "src, dest" is fine.

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

There's really no way we'd consider breaking possibly millions of working 
programs to change the parameter names. I guess you could come up with some way 
of supporting both sets of parameter names, but I doubt we'd accept that, 
either.

While maybe in hindsight we should have chosen the parameter names that "ln -s" 
uses, that ship has sailed, and we'll have to live with it like it is.

--

___
Python tracker 

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



[issue39940] Micro-optimizations to PySequence_Tuple()

2021-08-05 Thread Marco Sulla


Marco Sulla  added the comment:

Close it, I have no time now :-(

--
resolution:  -> later
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread krey


krey  added the comment:

@eric.smith Fair enough, though the impact would probably be quite low in 
reality. Nobody seems to pass these args by keyword: 
https://github.com/search?q=%22os.symlink(src%3D%22&type=Code

@steven.daprano My suggestion was changing the names of the args, not the order

Current
def os.symlink(src, dst):
ln -s src dst

Changing the names
def os.symlink(dst, src):
ln -s dst src

Changing the order
def os.symlink(dst, src):
ln -s src dst

I concede that different unixes have different argnames for ln, it's a bit of a 
mess. From a CS theory perspective, I think the GNU convention makes more sense.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44839] Convert Python exceptions to appropriate SQLite error codes

2021-08-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +26107
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27613

___
Python tracker 

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



[issue44839] Convert Python exceptions to appropriate SQLite error codes

2021-08-05 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently, any exception raised in user-defined function set the general 
SQLITE_ERROR error which then produce sqlite3.OperationalError.

For example, if the user function returns a string or bytes object larger than 
INT_MAX you get OperationalError, but if it is less than INT_MAX and larger 
than the SQLite limit (configurable, 10 by default) you get DataError. 
If a memory error occurred in Python code you get OperationalError, but if it 
is occurred in the SQLite code you get MemoryError.

The proposed PR sets corresponding SQLite error codes for MemoryError and 
OverflowError in user-defined functions. They will produce MemoryError and 
DataError in Python.

--
components: Extension Modules
messages: 398997
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert Python exceptions to appropriate SQLite error codes
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44839] Convert Python exceptions to appropriate SQLite error codes

2021-08-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was grown from bigmem tests for issue44822.

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

There is no one single set of names used by `ln` that we could have 
chosen. Any choice we made would have annoyed some people.

I strongly argue that, of all the various naming conventions in common 
usage (see below), Python's choice of src, dest (source, destination) is 
the most clear and understandable. Source is the source file, the 
original file. When a symlink is made, it gets written to the 
destination path, dest. Clear and straightforward.

Using "target" is ambiguous, "target" can mean the target of the 
symbolic link (where the sym link points, i.e. the original file) *or* 
it can mean the target of the `ln` command, i.e. where the symlink is 
created.

Some of the common naming conventions:

POSIX, NetBSD, FreeBSD, MacOS use source_file, target_file.

OpenBSD uses source, target.

Solaris uses source_file, target.

AIX uses SourceFile, TargetFile.

GNU uses target, linkname.

https://unix.stackexchange.com/questions/541795/tips-for-remembering-the-order-of-parameters-for-ln

Windows mklink not only uses yet another set of names, but puts them in 
the opposite order: link, target.

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

MKS Toolkit calls them old, new.

https://www.mkssoftware.com/docs/man1/ln.1.asp

The Open Group Base Specifications document calls them path1, path2.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html#

--

___
Python tracker 

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



[issue44837] os.symlink arg names are bad

2021-08-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Thu, Aug 05, 2021 at 12:00:31PM +, krey wrote:

> @steven.daprano My suggestion was changing the names of the args, not the 
> order
> 
> Current
> def os.symlink(src, dst):
> ln -s src dst

So far so good.

> Changing the names
> def os.symlink(dst, src):
> ln -s dst src

That's not changing the names, that's changing the order.

You're putting the destination first, and the source second. That's the 
opposite order to that of `ln` in all the Unixes I can find, but it 
matches the order of Windows, which seems to be the only OS I can see 
that puts the destination (the path to the symlink) first and the source 
(the path to the target/original) second.

In any case, we have no power to change the order of arguments to `ln`.

> Changing the order
> def os.symlink(dst, src):
> ln -s src dst

And that's just confused, because you have `ln` use the same order it 
has now, and symlink reverse the order.

> I concede that different unixes have different argnames for ln, it's a 
> bit of a mess. From a CS theory perspective, I think the GNU 
> convention makes more sense.

The GNU convention is the same convention as all the other Unixes, and 
os.symlink. Only the documented names are different.

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

Oh, this is a difficult one.

It's caused by GH-27506 that was recently added to produce better errors for 
things like `print('hello' if something)`, where the correct syntax is 
`print('hello' if something else 'hi').

This is going to have a lot of false positives though, especially in cases like 
this, where an if statement immediately follows a line with unclosed 
parentheses.

What do you think, Pablo? Should we maybe revert this?

--

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Ned Batchelder


New submission from Ned Batchelder :

Note: this is very similar to https://bugs.python.org/issue42810
This was originally reported against coverage.py: 
https://github.com/nedbat/coveragepy/issues/1205

---8<-
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

print(sys.version)
sys.settrace(trace)

def func():
if A:
if B:
if C:
if D:
return False
else:
return False
elif E and F:
return True

A = B = True
C = False

func()
-

This produces this trace output:

3.10.0rc1 (default, Aug  3 2021, 15:03:55) [Clang 12.0.0 (clang-1200.0.32.29)]
call 13: def func():
line 14: if A:
line 15: if B:
line 16: if C:
line 21: elif E and F:
retu 21: elif E and F:

The elif on line 21 is not executed, and should not be traced.

Also, if I change line 21 to `elif E:`, then the trace changes to:

3.10.0rc1 (default, Aug  3 2021, 15:03:55) [Clang 12.0.0 (clang-1200.0.32.29)]
call 13: def func():
line 14: if A:
line 15: if B:
line 16: if C:
line 22: return True
retu 22: return True

--
components: Interpreter Core
keywords: 3.10regression
messages: 399003
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Nested if/else gets phantom else trace again (3.10)
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue44762] getpass.getpass on Windows fallback detection is incomplete

2021-08-05 Thread Eryk Sun


Eryk Sun  added the comment:

The `sys.stdin is not sys.__stdin__` check is not relevant information. We need 
to know whether msvcrt.getwch() works and that the user should be able to type 
the password in the console window. sys.__stdin__ could be a file object for 
the NUL device, a pipe, or a file.

Also, this check has never been implemented in POSIX. If I run `python -m 
idlelib` in Linux, getpass() still reads the password from the terminal instead 
of sys.stdin.

> IDLE's stdio connected to Shell passes isatty

IOBase.isatty() is more abstract than I expected, since it can be true for any 
stream that's "interactive". While FileIO.isatty() and os.isatty() are 
definitely wrong in Windows (i.e. they should not be true for NUL or a 
serial/parallel port), I see now that fixing isatty() doesn't solve the 
problem. 

We need to directly check whether sys.stdin is a console. If so, we can 
reasonably assume that there's a visible, accessible console window. The check 
would be something like:

try:
_winapi.GetConsoleMode(msvcrt.get_osfhandle(sys.stdin.fileno()))
except (AttributeError, OSError):
return fallback_getpass(prompt, stream)

_winapi.GetConsoleMode() would need to be implemented.

This is inconsistent with Unix since it's not trying to open "CONIN$". But 
relying on the latter is problematic in Windows since it succeeds in any 
process that's attached to a console session, even if the console window is 
hidden or never created (i.e. CREATE_NO_WINDOW).

--

___
Python tracker 

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



[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

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



[issue44291] Unify logging.handlers.SysLogHandler behavior with SocketHandlers

2021-08-05 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 3d315c311676888201f4a3576e4ee3698684a3a2 by Kirill Pinchuk in 
branch 'main':
bpo-44291: Fix reconnection in logging.handlers.SysLogHandler (GH-26490)
https://github.com/python/cpython/commit/3d315c311676888201f4a3576e4ee3698684a3a2


--

___
Python tracker 

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



[issue44841] ZipInfo crashes on filemode

2021-08-05 Thread Gabor Rakosy


New submission from Gabor Rakosy :

"""
ZipInfo crashes on filemode

In file /usr/lib/python3.7/zipfile.py | class ZipInfo.__slots__
Does not contain keyword 'filemode'.
"""

import zipfile

file_zip = zipfile.ZipFile("test-one-dir.zip", mode='r')

res = []

info = file_zip.infolist()
print("info[0]", type(info[0]), info[0])

print("\n# ## Good")
for inf in info:
print("\ninf", type(inf), inf)
res.append((
inf.filename,
##inf.filemode,
inf.compress_type,
inf.compress_size,
inf.file_size))

for fileinfo in res:
print("\n", fileinfo)

print("\n# ## Bad")
for inf in info:
print("\ninf", type(inf), inf)
res.append((
inf.filename,
inf.filemode,
inf.compress_type,
inf.compress_size,
inf.file_size))

for fileinfo in res:
print("\n", fileinfo)

--
components: Library (Lib)
messages: 399006
nosy: G.Rakosy
priority: normal
severity: normal
status: open
title: ZipInfo crashes on filemode
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue36424] Pickle fails on frozen dataclass that has slots

2021-08-05 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This was fixed in https://github.com/python/cpython/pull/25786 , and so can be 
closed.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44814] python 3.9.6 installation installs 0 modules

2021-08-05 Thread nyizel


Change by nyizel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue44842] String conversion of Path removes '/' from original url

2021-08-05 Thread Manish Satwani


New submission from Manish Satwani :

import pathlib
p = pathlib.Path('adl://myblob.azuredatalakestore.net/local/abc/xyz')
s = str(p)
print(s)
what you expect s to be??
There is a bug in path.Path.str(conversion to string) and it remove a slash
s is 'adl:/myblob.azuredatalakestore.net/local/abc/xyz' <-- this is getting 
printplz fix it

--
components: Library (Lib)
messages: 399008
nosy: manish.satwani
priority: normal
severity: normal
status: open
title: String conversion of Path removes '/' from original url
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue44842] String conversion of Path removes '/' from original url

2021-08-05 Thread Manish Satwani


Manish Satwani  added the comment:

import pathlib
p = pathlib.Path('adl://myblob.azuredatalakestore.net/local/abc/xyz')
s = str(p)
print(s)
what you expect s to be??
There is a bug in path.Path.str(conversion to string) and it remove a slash
s is 'adl:/myblob.azuredatalakestore.net/local/abc/xyz' <-- this is getting 
printplz fix it

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Bas van Beek


Change by Bas van Beek :


--
pull_requests: +26108
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/27614

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is a tricky one because the tokenizer doesn't see the enclosed parentheses 
because is actually closed (the second print has two 
')' parentheses).

This is tricky indeed because the parser is parsing the ( after the print as a 
group, not as a call, and indentation doesn't matter in the group.

We can indeed revert the PR but I'm afraid that you can use this pattern to 
actually trigger a bunch of other custom error messages where they should not.

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Bas van Beek


Bas van Beek  added the comment:

All right, the `__name__` bug fix is up at 
https://github.com/python/cpython/pull/27614.

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Andre Roberge


Andre Roberge  added the comment:

I have no idea how the parser works ... but when you do the test to identify if 
an 'else' is missing, could the fact that there is a colon instead of the 
expected 'else' be used to avoid misidentifying this case?

Note: I am keenly aware of the difficulties in identifying possible cause of 
syntax errors and do appreciate the many improvements that have been done.

--

___
Python tracker 

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



[issue44842] String conversion of Path removes '/' from original url

2021-08-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

pathlib is not designed to support URIs, so this behavior is not surprising. 

You want to use a different library, maybe urllib.

--
nosy: +eric.smith

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Technically this example si more or less equivalent to:

[ something, blech

if 42:
   True

[Bluch]]

I wonder if the better fix here is just not to raise the rule if we find a ':', 
which is the only token that actually makes sense after 

'if' expression

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am confusing. Why do these objects should have __name__ and __qualname__ 
attributes? What document specifies this? How are these attributes used?

collections.abc.MutableSet and typing.MutableSet are different things. The 
former is a class, the latter is not a class. I don't know exact reasons, but 
it was intentional. We introduced __mro_entries__ for this (it was significant 
intervention in class creation mechanism).

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +26109
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27615

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> but when you do the test to identify if an 'else' is missing, could the fact 
> that there is a colon instead of the expected 'else' be used to avoid 
> misidentifying this case?

Yeah! That is what I was thinking. The key here is that the ':' is the only 
token that is valid after the construct, so anything else is a wrong 'if' 
expression, no matter what it is.

--
stage: patch review -> 

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Opened https://github.com/python/cpython/pull/27615

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f5cbea6b1b5fc39cca377c6cc93f222916015fc4 by Pablo Galindo Salgado 
in branch 'main':
bpo-44838: Refine the custom syntax errors for invalid 'if' expressions 
(GH-27615)
https://github.com/python/cpython/commit/f5cbea6b1b5fc39cca377c6cc93f222916015fc4


--

___
Python tracker 

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



[issue44291] Unify logging.handlers.SysLogHandler behavior with SocketHandlers

2021-08-05 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +26110
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27616

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin

Ken Jin  added the comment:

@Serhiy a summary from what I understand. I hope this helps:

> I am confused. Why do these objects should have __name__ and __qualname__ 
> attributes? What document specifies this?

I don't think any doc specifies this. The docs for __name__ and __qualname__ 
say they apply only to "name of the class, function, method, descriptor, or 
generator instance". The typing "types" are objects, not classes, so normally 
they wouldn't apply, but maybe there is an exception (see below).

> How are these attributes used?

According to OP, for logging/printing purposes. Initially, I was slightly 
against adding this. But I realized that it make sense for ABCs and concrete 
classes. PEP 585 says that the builtin types.GenericAlias is a "thin proxy type 
that forwards all method calls and attribute accesses to the bare origin 
type"[1] with some exceptions. typing._GenericAlias is supposed to behave 
similarly to builtin version.

>>> list[int].__name__
'list'
>>> collections.abc.Callable[[int], str].__name__
'Callable'

Both typing.List[int].__name__ and typing.Callable[int].__name__ raised error 
before Yurii's PR. So I think it's good that we aligned typing's behavior and 
the builtin version.

[1] 
https://www.python.org/dev/peps/pep-0585/#parameters-to-generics-are-available-at-runtime

I just realized Łukasz wrote PEP 585, so maybe he can shed some insight too.

--

___
Python tracker 

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



[issue44818] '\t' (tab) support

2021-08-05 Thread Pooia


Pooia  added the comment:

Awesome, thanks!

On Thu, Aug 5, 2021 at 3:14 PM Erlend E. Aasland 
wrote:

>
> Erlend E. Aasland  added the comment:
>
> > I guess Python can't support tab
>
> AFAIK, it was a deliberate decision during the Python 2 => Python 3
> transition.
>
> > [...] it sounds Gnu nano mix spaces and tabs!
>
> You can set up GNU nano to expand tabs:
>
> $ echo "set tabstospaces" >> ~/.nanorc
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread miss-islington


miss-islington  added the comment:


New changeset b1bd16c2528295b8b28395827f6b589dccea0624 by Pablo Galindo Salgado 
in branch '3.10':
[3.10] bpo-44838: Refine the custom syntax errors for invalid 'if' expressions 
(GH-27615). (GH-27616)
https://github.com/python/cpython/commit/b1bd16c2528295b8b28395827f6b589dccea0624


--
nosy: +miss-islington

___
Python tracker 

___
___
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-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

[Serhiy]
> In particularly it allows to modify __dict__ of builtin types.

This doesn't look like something that would happen accidentally.  We've never 
had any bug reports about this occurring in the wild.


[GvR]
> Maybe we should not fix this then?

That seems reasonable.  In general, it is hard to completely wall-off instances 
against deliberate efforts to pry them open:

>>> from types import MappingProxyType
>>> import gc
>>> orig = {1: 2}
>>> proxy = MappingProxyType(orig)
>>> refs = gc.get_referents(proxy)
>>> refs
[{1: 2}]
>>> refs[0][1] = 3
>>> orig
{1: 3}

--

___
Python tracker 

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



[issue44605] functools.total_ordering doesn't work with metaclasses

2021-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Do you all have preference for 1) expanding the range of use cases to cover 
metaclasses but incurring a performance hit for common cases, or 2) leaving it 
as-is and documenting that it doesn't work for metaclasses?

--

___
Python tracker 

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



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44828] Using tkinter.filedialog crashes on macOS Python 3.9.6

2021-08-05 Thread Ned Deily

Ned Deily  added the comment:

> I used brew.sh to install Python, which I think uses the universal installer

As far as I know, Homebrew builds its own Python and Tk.

> After I reinstall macOS, if you need further testing, i’m open to trying.

Thanks. I think the next step would be to try to reproduce just using Tcl and 
Tk as this most likely is an issue in Tk rather than Python.  It's also quite 
possible that the underlying problem will be fixed in a future Monterey beta. 
Alas, I don't have time to look further into this in the immediate future.  
Perhaps someone can follow up directly with the Tk folks.

--
nosy: +culler

___
Python tracker 

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



[issue41946] Add concrete examples to os.path documentation

2021-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Concrete examples for os.path are problematic because typical inputs and 
outputs vary across difference file systems.  The point of os.path is to hide 
these differences.

--
nosy: +rhettinger

___
Python tracker 

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



[issue44843] Add CLI flag to disable hash randomization

2021-08-05 Thread Filipe Laíns

New submission from Filipe Laíns :

There are select use-cases where hash randomization is undesirable, having a 
CLI option to switch it off would be very helpful.
One example would be packaging, where hash randomization will make the bytecode 
unreproducible.

Currently, we have to set PYTHONHASHSEED to a constant value. Having a CLI 
option (lets say -Z) would allow use to do

  python -Zm install artifact.whl

instead of

  PYTHONHASHSEED=0 python -m install artifact.whl

Which is something that I have to do lots of places.

--
messages: 399026
nosy: FFY00
priority: normal
severity: normal
status: open
title: Add CLI flag to disable hash randomization
versions: Python 3.11

___
Python tracker 

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



[issue41946] Add concrete examples to os.path documentation

2021-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If some examples are added, the should note which operating system is being 
used.

--

___
Python tracker 

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



[issue44605] functools.total_ordering doesn't work with metaclasses

2021-08-05 Thread Glyph Lefkowitz


Glyph Lefkowitz  added the comment:

> Do you all have preference for 1) expanding the range of use cases to cover 
> metaclasses but incurring a performance hit for common cases, or 2) leaving 
> it as-is and documenting that it doesn't work for metaclasses?

If we do need the slow approach for the meta-type case, (i.e.: 
type(self).__lt__(other)) then why not decide on implementation at decoration 
time? The decorator has enough information to know if this strategy is 
necessary and can put different special methods in place.

(But also, wouldn't 'from operator import lt ... lt(self, other)' be a bit 
faster, and also more general, just because it's doing specialized dispatch in 
C rather than an additional Python function call / method dispatch?  I have not 
benchmarked myself, so please ignore if you've already tested this.)

--

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-08-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Ken Jin.

But it does not explain why objects which currently have __name__/__qualname__ 
is None should have these attribute. There is no builtin data type that 
corresponds to ClassVar, Final, Literal, Concatenate or TypeGuard. And (int | 
str) does not have these attributes. Would not be better to raise 
AttributeError instead of returning None?

--

___
Python tracker 

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



[issue44844] The command line of launching Edge on Linux hangs

2021-08-05 Thread Ray Luo


New submission from Ray Luo :

Launching Chrome on Linux from command line:

$ export BROWSER=google-chrome; python -m webbrowser 
https://httpbin.org/delay/10

It can successfully launch Chrome with the specified web page opened in a 
new tab.
And the console command line finishes BEFORE the web page being fully 
loaded in the browser. That is the desirable behavior.

Launching Edge on Linux from command line:

$ export BROWSER=microsoft-edge; python -m webbrowser 
https://httpbin.org/delay/10

The command line hangs until the Edge window is closed.

That hanging symptom can be resolved by writing a deliberate script to 
webbrowser.register("...", None, 
webbrowser.BackgroundBrowser("microsoft-edge")) and then use that registered 
browser. But it was not obvious, and it took trial-and-error to reach that 
solution.

Could it be possible to have the "BROWSER=microsoft-edge; python -m webbrowser 
https://httpbin.org/delay/10"; work out of the box, without hanging?

Is it because Edge is not currently predefined and handled inside 
webbrowser.py? It seems not an easy decision to add new browser into 
webbrowser.py, though, based on the 2nd and 3rd comments in this old issue: 
https://bugs.python.org/issue42330

--
components: Library (Lib)
messages: 399030
nosy: rayluo
priority: normal
severity: normal
status: open
title: The command line of launching Edge on Linux hangs
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue44835] What does "Python for Windows will still be Python for DOS" mean?

2021-08-05 Thread Steve Dower


Steve Dower  added the comment:

Yep, it's just a thank you and acknowledgement that was in the installer, so I 
brought it forward.

However, we removed it a couple of versions ago (with Mark's permission). So 
it's certainly not an issue that needs to be addressed now ;)

--

___
Python tracker 

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



[issue22240] argparse support for "python -m module" in help

2021-08-05 Thread Jakub Wilk


Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue41946] Add concrete examples to os.path documentation

2021-08-05 Thread Jack DeVries


Jack DeVries  added the comment:

> Some examples were added since this issue was created

See bpo-35183

--
nosy: +jack__d

___
Python tracker 

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



[issue44830] Broken Mozilla devguide link in "Dealing with Bugs" doc section

2021-08-05 Thread Jack DeVries


Jack DeVries  added the comment:

For reference, it looks like Wayback Machine has a snapshot of the old article 
for reference: 
https://web.archive.org/web/20210613191914/https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines

@mark.dickinson, do you feel like that new article is a good drop-in 
replacement for the old one? It is a bit different. I can open up a PR if so!

--
nosy: +jack__d

___
Python tracker 

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



[issue44845] Allow keyword arguments in code.__new__

2021-08-05 Thread Patrick Reader


New submission from Patrick Reader :

Per bpo-41263, code.__new__ now uses Argument Clinic. However, it still has a / 
marker which prevents the use of keyword arguments 
(https://github.com/python/cpython/pull/21426/files#diff-6f869eb8beb7cbe4bc6817584b99ad567f88962fa67f7beca25d009dc401234dR465).

It seems entirely unnecessary to have this, so could it be removed to allow 
easier construction of code objects from user code, or is it there for some 
specific reason?

I can do a PR - it's a 1 line change (+ clinic output changes) (+ tests?).

I don't imagine backwards-compatibility is a concern here given it's 
implementation-specific and basically private.

Note that prior to that fix, keyword arguments were allowed in the constructor 
but completely ignored.

--
components: Interpreter Core
messages: 399034
nosy: pxeger
priority: normal
severity: normal
status: open
title: Allow keyword arguments in code.__new__
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44697] Memory leak when asyncio.open_connection raise

2021-08-05 Thread Jack DeVries


Change by Jack DeVries :


--
keywords: +patch
nosy: +jack__d
nosy_count: 6.0 -> 7.0
pull_requests: +26111
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27617

___
Python tracker 

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



[issue44697] Memory leak when asyncio.open_connection raise

2021-08-05 Thread Jack DeVries


Change by Jack DeVries :


--
pull_requests:  -26111

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread Jack DeVries


Change by Jack DeVries :


--
keywords: +patch
nosy: +jack__d
nosy_count: 2.0 -> 3.0
pull_requests: +26112
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27618

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread Jack DeVries


Jack DeVries  added the comment:

@gaydayav I agree.

--

___
Python tracker 

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



[issue44842] String conversion of Path removes '/' from original url

2021-08-05 Thread Manish Satwani


Manish Satwani  added the comment:

Thanks for the update Eric, if it is not designed to support URI it should tell 
to the user. It is very wired it just returns wrong data.

You can detect it very well if user has specified URI or not.

--

___
Python tracker 

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



[issue44844] The command line of launching Edge on Linux hangs

2021-08-05 Thread Steve Dower


Steve Dower  added the comment:

Adding a new browser should be pretty easy, and it seems like that's all that 
is needed here. It has to go into a few places though to support each platform, 
and unfortunately it's only good for 3.11, and not any of the existing releases.

--
keywords: +easy, newcomer friendly
nosy: +steve.dower
versions: +Python 3.11 -Python 3.7

___
Python tracker 

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



[issue33140] shutil.chown should not be defined in Windows

2021-08-05 Thread Jack DeVries


Jack DeVries  added the comment:

I'm pretty sure the 3.11 dev cycle started since this conversation, right? Can 
we introduce the deprecation warning now? Maybe something like what is in the 
attached diff?

@andrei.avk, if it turns out that the time has come, you can go ahead and take 
the PR if you wish!

--
nosy: +jack__d
Added file: https://bugs.python.org/file50203/roughly_add_depr_warning.diff

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread miss-islington


miss-islington  added the comment:


New changeset 938e84b4fa410f1a86f5e0708ebc3af6bb8efb0e by Jack DeVries in 
branch 'main':
bpo-44679: [doc] fix typo in unittest.mock.rst (GH-27618)
https://github.com/python/cpython/commit/938e84b4fa410f1a86f5e0708ebc3af6bb8efb0e


--
nosy: +miss-islington

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26113
pull_request: https://github.com/python/cpython/pull/27619

___
Python tracker 

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



[issue33140] shutil.chown should not be defined in Windows

2021-08-05 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Jack: I'm not sure if this eventual fix is worth doing.. it might cause issues 
for users to leave it as is, but can also cause issues to remove it even after 
deprecation period; I don't have a good feeling if one is more likely than the 
other, - so I'll have to leave it for others to review the PR; thanks for 
following up on this though!

--

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26114
pull_request: https://github.com/python/cpython/pull/27620

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread Mariatta


Change by Mariatta :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44679] unittest.mock.sentinel documentation typo

2021-08-05 Thread miss-islington


miss-islington  added the comment:


New changeset 0a642d57736be6802c712bdbf2dcff39fe8a39b7 by Miss Islington (bot) 
in branch '3.10':
bpo-44679: [doc] fix typo in unittest.mock.rst (GH-27618)
https://github.com/python/cpython/commit/0a642d57736be6802c712bdbf2dcff39fe8a39b7


--

___
Python tracker 

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



[issue44803] change tracemalloc.BaseFilter to an abstract class

2021-08-05 Thread Łukasz Langa

Łukasz Langa  added the comment:

> if you ask me, I would change all of them

The problem with adopting an ABC base class for each such use case is two-fold:
- it changes the MRO putting the ABCMeta metaclass in which might make existing 
subclasses suddenly incompatible; and
- is costly in terms of performance even if subclasses are still compatible.

In other words, putting ABC in isn't a transparent operation. This is one 
reason why it wasn't included in asyncio code.

Since we're not reacting to any breakage here, I'd feel best leaving this 
alone. Thanks for your care Anton!

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue44842] String conversion of Path removes '/' from original url

2021-08-05 Thread Eric V. Smith


Eric V. Smith  added the comment:

But that's a perfectly valid filename:

$ mkdir -p adl://myblob.azuredatalakestore.net/local/abc/xyz
$ ls -R adl:
'adl:':
myblob.azuredatalakestore.net/

'adl:/myblob.azuredatalakestore.net':
local/

'adl:/myblob.azuredatalakestore.net/local':
abc/

'adl:/myblob.azuredatalakestore.net/local/abc':
xyz/

'adl:/myblob.azuredatalakestore.net/local/abc/xyz':

The pathlib module isn't going to guess whether you passed it a filename or URI 
of some sort, especially when it's a valid filename. That's the caller's job to 
get right.

Removing the double slashes is a normal part of pathlib's behavior of 
normalizing paths, just as if you said from a bash shell "ls //etc//sysconfig", 
which will show the contents of "/etc/sysconfig". Although I'll admit I 
couldn't find this documented anywhere with a quick search.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue44605] functools.total_ordering doesn't work with metaclasses

2021-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

[Glyph]
> why not decide on implementation at decoration time?

We could do that and not incur performance issues.  However, it would expand 
the API and double the size of the code.  

We've had no other reports about this issue since total_ordering() was added in 
Python 2.7, nor have there been any questions about it on StackOverflow.  Do 
you think anyone other than yourself would use this feature?

It seems like a rare niche use case, and the workaround is simple.

For production code, I usually recommend writing out the other three methods 
(that is less magical, runs faster, easier to test, has fewer  dependencies, 
and makes the tracebacks more readable.

> (But also, wouldn't 'from operator import lt ... lt(self, other)'
> be a bit faster, and also more general, 

The lt() function emulates the '<' operator, so we still have the problems with 
reflection that we were trying to avoid by calling the __lt__ method directly.

--

___
Python tracker 

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



[issue44846] zipfile: cannot create zip file from files with non-utf8 filenames

2021-08-05 Thread Joel Puig Rubio


New submission from Joel Puig Rubio :

I'm attempting to make a script to create ZIP archives from files which 
filenames are encoded in Shift-JIS. However, Python seems to limit its 
filenames to ASCII or UTF-8, which means that attempting to archive said files 
will raise an exception. This is very inconvenient.

joel@bliss:~/test$ python3 -m zipfile -c mojibake.zip .
Traceback (most recent call last):
  File "/usr/lib/python3.8/zipfile.py", line 457, in _encodeFilenameFlags
return self.filename.encode('ascii'), self.flag_bits
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: 
ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
  File "/usr/lib/python3.8/zipfile.py", line 2441, in 
main()
  File "/usr/lib/python3.8/zipfile.py", line 2437, in main
addToZip(zf, path, zippath)
  File "/usr/lib/python3.8/zipfile.py", line 2426, in addToZip
addToZip(zf,
  File "/usr/lib/python3.8/zipfile.py", line 2421, in addToZip
zf.write(path, zippath, ZIP_DEFLATED)
  File "/usr/lib/python3.8/zipfile.py", line 1775, in write
with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
  File "/usr/lib/python3.8/zipfile.py", line 1517, in open
return self._open_to_write(zinfo, force_zip64=force_zip64)
  File "/usr/lib/python3.8/zipfile.py", line 1614, in _open_to_write
self.fp.write(zinfo.FileHeader(zip64))
  File "/usr/lib/python3.8/zipfile.py", line 447, in FileHeader
filename, flag_bits = self._encodeFilenameFlags()
  File "/usr/lib/python3.8/zipfile.py", line 459, in _encodeFilenameFlags
return self.filename.encode('utf-8'), self.flag_bits | 0x800
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-7: 
surrogates not allowed

The zip command from the Linux Info-ZIP package is able to create the same 
archive with no issues, which I've attached to this issue. Here you can see how 
the proper filenames are shown in WinRAR once the right encoding is selected: 
https://i.imgur.com/TVcI95A.png

The same should be seen on any computer using Shift-JIS as their locale.

--
components: Library (Lib)
files: mojibake.zip
messages: 399049
nosy: joelpuig
priority: normal
severity: normal
status: open
title: zipfile: cannot create zip file from files with non-utf8 filenames
versions: Python 3.8
Added file: https://bugs.python.org/file50204/mojibake.zip

___
Python tracker 

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



[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-08-05 Thread Tobias Bergkvist

Tobias Bergkvist  added the comment:

This makes a lot of sense now.

Thank you so much for the thorough explanation Ned - and for highlighting where 
my assumptions were wrong!

I didn’t realise I needed to specify MACOSX_DEPLOYMENT_TARGET to enable 
backwards compatibility. Is there a reason for not setting this to as old a 
version as possible by default when running ./configure? (Bigger binaries? Or 
something else?)

If I understand correctly, the following two statements are now equivalent (in 
Python >= 3.9, but not in Python == 3.8), after the added Python-support for 
weak linking you mention:

```
if (__builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)) { // 
...
If (HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME) { // ...
```
From: 
https://github.com/python/cpython/blob/3d315c311676888201f4a3576e4ee3698684a3a2/Modules/_ctypes/callproc.c#L1452


And in order to support the deprecated case of building on an older 
MacOS-version, I would want to do something like the following:

```
#ifdef __APPLE__
#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
// leave current implementation as is
#else
// dynamic loading implementation
#endif
#endif
```

That way, dynamic loading will only be used when building on old MacOS, and we 
keep the current code path using weak linking when possible.

This means we will still get useful compiler errors if for example Apple 
decides to suddenly remove the _dyld_shared_cache_contains_path symbol again in 
the future, or change its signature - rather than having to wait for the test 
suite to fail. It makes sense to prioritise good error reporting for the latest 
version of MacOS, since this will reduce the debugging time for CPython 
developers whenever Apple introduces new breaking changes to MacOS.

--

___
Python tracker 

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



[issue44605] functools.total_ordering doesn't work with metaclasses

2021-08-05 Thread Glyph Lefkowitz


Glyph Lefkowitz  added the comment:

> We could do that and not incur performance issues.  However, it would expand 
> the API and double the size of the code.  

If the preference is to not support this use-case, then I'd rather the 
decorator simply raise an exception and tell me this is going to be a problem 
so I can eagerly implement the workaround.

> It seems like a rare niche use case, and the workaround is simple.

It does seem like there are various times that one might want to make classes 
orderable, for example if they are bound to IDL objects or database tables; the 
use-case where I ran into this was something like that.

> For production code, I usually recommend writing out the other three methods 
> (that is less magical, runs faster, easier to test, has fewer  dependencies, 
> and makes the tracebacks more readable.

Wait, is the suggestion here that @total_ordering is not suitable for 
production?

--

___
Python tracker 

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



[issue33140] shutil.chown should not be defined in Windows

2021-08-05 Thread Jack DeVries


Jack DeVries  added the comment:

Yes, I definitely get that, but that's what the deprecation cycle is for. 
Certainly hold off on a PR until we see what @steve.dower thinks.

I personally feel that having a function that can be introspected with ``dir`` 
but which should not be used is confusing, and rightfully pointed out as a 
wrinkle in the API.

--

___
Python tracker 

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



[issue40935] Links to Python3 docs for some libs return 404

2021-08-05 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It looks like all the pages listed were updated with working links to current 
stable release docs, so this can be closed and if somebody finds more broken 
links, this issue can be reopened later.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44605] functools.total_ordering doesn't work with metaclasses

2021-08-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> If the preference is to not support this use-case ,,,

I don't really have a preference.  Was just letting you know the pros and cons. 
 I'll put together a PR with the "type(self).__lt__(self, other)" 
substitutions.  Let me know if that is the outcome you want.

> Wait, is the suggestion here that @total_ordering
> is not suitable for production?

It works fine, but as noted in the docs, the indirect code isn't as good as 
just writing-out the methods by hand.

--

___
Python tracker 

___
___
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-08-05 Thread Brandt Bucher

Brandt Bucher  added the comment:

I’m okay with closing as “won’t fix”.

--

___
Python tracker 

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



  1   2   >