[Python-Dev] raising a io exception when fileno is requested on a tarfile FileInFile

2021-10-29 Thread Stephen J. Turnbull
makap...@gmail.com writes:

 > When you call extractfile() on a TarFile, the result is a buffered
 > version of a _FileInFile pseudo-file.  When fileno() is called on
 > this resulting file, fileno() it not exist (understandably) and an
 > AttributeError is raised.  I would like to suggest raising an
 > io.UnsupportedOperation instead, so that file would act more like
 > other file-like objects.

I have no opinion on the suggestion itself, but it's well-formulated
and plausible.

That said, it's a clear backward incompatibility because code
currently expecting AttributeError exceptions won't catch this (unless
io.UnsupportedOperation is derived from AttributeError), so it will
have to wait until the next feature release for sure, and might need a
deprecation cycle.  I suggest that you file an issue on the GitHub
tracker so it won't get lost, and post it to this thread.

Steve


___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/XQBM7MMDZ5Z6KIEY4JIYSCEPUWVBC5FT/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-10-29 Thread Brett Cannon
FYI I opened https://github.com/python/cpython/pull/29170 to loosen/correct the 
definition of "iterator", but I got push-back on the PR and this thread never 
reached a clear conclusion. As such I'll ask the SC to make a call.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EKPXVWPBUS4AGPDTBEEVV7VNMMDUZ4LW/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Oh wow, this is really impressive

2021-10-29 Thread Abdur-Rahmaan Janhangeer
The last thing Py which got a  from me
was pip's caching mechanism when
installing packages!
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2KBC6XWFH5S6ONMY25XCZZRDASHWY3RS/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Summary of Python tracker Issues

2021-10-29 Thread Python tracker

ACTIVITY SUMMARY (2021-10-22 - 2021-10-29)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open7249 (+50)
  closed 50157 (+46)
  total  57406 (+96)

Open issues with patches: 2868 


Issues opened (77)
==

#45235: argparse does not preserve namespace with subparser defaults
https://bugs.python.org/issue45235  reopened by paul.j3

#45396: Custom frozen modules get ignored.
https://bugs.python.org/issue45396  reopened by eric.snow

#45563: inspect.getframeinfo() doesn't handle frames without lineno
https://bugs.python.org/issue45563  reopened by lemburg

#45578: Missing tests for the dis module
https://bugs.python.org/issue45578  opened by nanjekyejoannah

#45580: argparse.ArgumentParser.add_mutually_exclusive_group : metavar
https://bugs.python.org/issue45580  opened by AbcSxyZ

#45581: [sqlite3] raise MemoryError if sqlite3_open_v2() returns SQLIT
https://bugs.python.org/issue45581  opened by erlendaasland

#45582: Rewrite getpath.c in Python
https://bugs.python.org/issue45582  opened by steve.dower

#45584: Clarifying truncating in documentation
https://bugs.python.org/issue45584  opened by Arthur-Milchior

#45585: Gzipping subprocess output produces invalid .gz file
https://bugs.python.org/issue45585  opened by mherrmann.at

#45587: argparse add_argument_group: distinguish title and description
https://bugs.python.org/issue45587  opened by SelfAdjointOperator

#45588: cached_method similar to cached_property to cache with classes
https://bugs.python.org/issue45588  opened by martenlienen

#45589: webbrowser does not handle opens under Windows WSL properly
https://bugs.python.org/issue45589  opened by guido.fioravantti

#45590: distutils: Upload failed (400): Invalid value for blake2_256_d
https://bugs.python.org/issue45590  opened by jwilk

#45592: NamespaceLoader does not implement create_module or exec_modul
https://bugs.python.org/issue45592  opened by FFY00

#45593: SpooledTemporaryFile.truncate returns None
https://bugs.python.org/issue45593  opened by rooter

#45594: Feature Request: add EHOSTUNREACH subclass to ConnectionError
https://bugs.python.org/issue45594  opened by ntc2

#45597: os.path.realpath returns invalid path for junction pointing to
https://bugs.python.org/issue45597  opened by grv87

#45598: setup.py grep_headers_for() is broken by design
https://bugs.python.org/issue45598  opened by christian.heimes

#45599: Please officially support %G, %V and %u directives in time lib
https://bugs.python.org/issue45599  opened by Raphael

#45600: First sentence in docs for os.environ
https://bugs.python.org/issue45600  opened by andrei.avk

#45602: The grammar misses links that are present everywhere else
https://bugs.python.org/issue45602  opened by Arthur-Milchior

#45606: pathlib.Path.glob() does not list dangling symlink when patter
https://bugs.python.org/issue45606  opened by raek

#45607: Make it possible to enrich an exception's error message
https://bugs.python.org/issue45607  opened by iritkatriel

#45609: Specialize STORE_SUBSCR
https://bugs.python.org/issue45609  opened by Dennis Sweeney

#45610: Cookies with longer paths are listed before cookies with short
https://bugs.python.org/issue45610  opened by IYism

#45611: pprint - low width overrides depth folding
https://bugs.python.org/issue45611  opened by iansedano

#45613: [sqlite3] set threadsafety attribute based on default SQLite t
https://bugs.python.org/issue45613  opened by erlendaasland

#45614: traceback of exception with non-unicode __module__
https://bugs.python.org/issue45614  opened by iritkatriel

#45615: Missing test for type of error when printing traceback for non
https://bugs.python.org/issue45615  opened by iritkatriel

#45616: Python Launcher Matches 3.10 instead of 3.1
https://bugs.python.org/issue45616  opened by Marsfan

#45617: sys.stdin does not iterate correctly on '\r' line separator
https://bugs.python.org/issue45617  opened by kbrazil

#45618: Documentation builds fail with Sphinx 3.2.1
https://bugs.python.org/issue45618  opened by Maciej Olko

#45619: Mentioning structural pattern matching in the list of binding
https://bugs.python.org/issue45619  opened by Arthur-Milchior

#45622: BlockingIOError: [Errno 11] Resource temporarily unavailable w
https://bugs.python.org/issue45622  opened by florinspatar

#45623: static build is broken
https://bugs.python.org/issue45623  opened by egorpugin

#45625: Add support for top-level await
https://bugs.python.org/issue45625  opened by Fred

#45626: Email part with content type message is multipart.
https://bugs.python.org/issue45626  opened by jdhowroyd

#45630: Dump CodeObject API for debugging
https://bugs.python.org/issue45630  opened by penguin_wwy

#45631: missing unittests for overlapping dest when using subparsers
https://bugs.python.org/issue45631  opened by paul.j3

#45632: Strange readline save history 

[Python-Dev] Re: Oh wow, this is really impressive

2021-10-29 Thread Pablo Galindo Salgado
I am glad you like it :)

I have been told that this is a very popular improvement. I promise to keep
looking for similar things in the future!

Regards from cloudy London,
Pablo Galindo Salgado

On Fri, 29 Oct 2021, 18:23 Steven D'Aprano,  wrote:

> I was using Python 3.10 and got this NameError when I mistyped a name:
>
> NameError: name 'KeyboardInterrupted' is not defined. Did you mean:
> 'KeyboardInterrupt'?
>
> It even works for attribute errors too.
>
> That's fantastic! This is a really amazing useability improvement, thank
> you everyone who was involved! I literally squeed :-)
>
> I just may spend a few days deliberately mistyping names in the REPL
> just to see this :-)
>
>
> --
> Steve
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/2CUCVKZ44IYCW5QRV4CMVC7YDYBCJFYG/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/BNXWMJDHBSBLCAMIRM4WY7O2YWXCJR6V/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Oh wow, this is really impressive

2021-10-29 Thread Steven D'Aprano
I was using Python 3.10 and got this NameError when I mistyped a name:

NameError: name 'KeyboardInterrupted' is not defined. Did you mean: 
'KeyboardInterrupt'?

It even works for attribute errors too.

That's fantastic! This is a really amazing useability improvement, thank 
you everyone who was involved! I literally squeed :-)

I just may spend a few days deliberately mistyping names in the REPL 
just to see this :-)


-- 
Steve
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2CUCVKZ44IYCW5QRV4CMVC7YDYBCJFYG/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 3118 C APIs

2021-10-29 Thread Antoine Pitrou


Hi Joannah,

On Thu, 21 Oct 2021 13:00:11 -0300
Joannah Nanjekye  wrote:
> Last year I opened the following issues, to implement
> int PyObject_CopyToObject() and PyObject *PyObject_GetMemoryView(PyObject
> *obj).
> 
> They were meant to be as part of PEP 3118, I wonder if they are worth an
> effort now.
> 
> https://bugs.python.org/issue39835
> https://bugs.python.org/issue39836

1) PyObject_GetMemoryView: would it do something different than
PyMemoryView_FromObject()?

2) PyObject_CopyToObject: I admit I don't really understand the use
case.  Besides the fact that the naming is confusing ("object copy to
object"?), it seems either PyBuffer_FromContiguous() or
PyBuffer_ToContiguous() should help implement similar functionality.

Regards

Antoine.


___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/O76HP4RKM3VGMCF6YNLRHD26MZPDHEWZ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] raising a io exception when fileno is requested on a tarfile FileInFile

2021-10-29 Thread makapuf2
Hi, 
When you call extractfile() on a TarFile, the result is a buffered version of a 
_FileInFile pseudo-file.
When fileno() is called on this resulting file, fileno() it not exist 
(understandably) and an AttributeError is raised.
I would like to suggest raising an io.UnsupportedOperation instead, so that 
file would act more like other file-like objects.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/JP4EYNRQOZ6PSEVYUJKS5HBHDR6VSKWF/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Naming convention for AST types

2021-10-29 Thread Larry Hastings


Hey, as public mailing list mistakes go, that one's pretty mild.


//arry/


On 10/28/21 6:35 PM, Jeremiah Vivian wrote:

Sorry for the two replies, I didn't think the first one would be sent.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/DNZMANF45N6WGGWYYN5JIQ67IDTCIL4Q/
Code of Conduct: http://python.org/psf/codeofconduct/
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EZBJIT4CYPVYRCBCPB2VA5PE2SB4OEI2/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Python multithreading without the GIL

2021-10-29 Thread Skip Montanaro
>
> Did you try running  the same code with stock Python?
>
> One reason I ask is the IIUC, you are using numpy for the individual
>  vector operations, and numpy already releases the GIL in some
> circumstances.
>

I had not run the same code with stock Python (but see below). Also, I only
used numpy for two bits:

1. I use numpy arrays filled with random values, and the output array is
also a numpy array. The vector multiplication is done in a simple for loop
in my vecmul() function.

2. Early on I compared my results with the result of numpy.matmul just to
make sure I had things right.

That said, I have now run my example code using both PYTHONGIL=0 and
PYTHONGIL=1 of Sam's nogil branch as well as the following other Python3
versions:

* Conda Python3 (3.9.7)
* /usr/bin/python3 (3.9.1 in my case)
* 3.9 branch tip (3.9.7+)

The results were confusing, so I dredged up a copy of pystone to make sure
I wasn't missing anything w.r.t. basic execution performance. I'm still
confused, so will keep digging.

It would also be fun to see David Beezley’s example from his seminal talk:
>
> https://youtu.be/ph374fJqFPE
>

Thanks, I'll take a look when I get a chance. Might give me the excuse I
need to wake up extra early and tag along with Dave on an early morning
bike ride.

Skip
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/YZYJIDFH6Y3YCD3LCBQPRDQXN2JGJA7N/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-10-29 Thread Antoine Pitrou
On Wed, 20 Oct 2021 02:55:52 +0200
Victor Stinner  wrote:
> 
> Debug build
> ---
> 
> When Python is built in debug mode, most compiler optimizations are
> disabled.  For example, Visual Studio disables inlining. Benchmarks must
> not be run on a Python debug build, only on release build: using LTO and
> PGO is recommended for reliable benchmarks. PGO helps the compiler to
> decide if function should be inlined or not.

So what is the performance impact on debug builds?  The numbers should
be given in the PEP.

> Rejected Ideas
> ==
> 
> Keep macros, but fix some macro issues
> --
> 
> Converting macros to functions is not needed to `remove the return
> value`_: casting a macro return value to ``void`` also fix the issue.
> For example, the ``PyList_SET_ITEM()`` macro was already fixed like
> that.
> 
> Macros are always "inlined" with any C compiler.
> 
> The duplication of side effects can be worked around in the caller of
> the macro.
> 
> People using macros should be considered "consenting adults". People who
> feel unsafe with macros should simply not use them.

This says that the idea is rejected, but it does not say *why* it was
rejected.  Can you add that?

Regards

Antoine.


___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/F57647TKEQLXX7JXAHUVCFWHUMU3SW2N/
Code of Conduct: http://python.org/psf/codeofconduct/