[issue45746] ftplib please revisit retrlines('RETR as it produces files without newlines

2021-11-07 Thread Matthew H. McKenzie


Matthew H. McKenzie  added the comment:

To answer your original questions : Linux Host and Client, amd MVS (EBCDIC 
records) to Linux.

hacks to overcome (in libftp):

def print_line(line):
'''Default retrlines callback to print a line.'''
print(line, end='')< suppress here

and... 
   if not line:
break
if line[-2:] == CRLF:   <== left these
line = line[:-2]
elif line[-1:] == '\n':
line = line[:-1]
callback(line + '\n')  <== added it back here.

--

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-11-07 Thread Martin


Martin  added the comment:

I submitted a pull request for the related issue43656:

https://github.com/python/cpython/pull/29299

It introduces a format_locals parameter that enables the customized formatting 
of a FrameSummary.

This way, a user of traceback could provide a function that handles exceptions 
within __repr__ if necessary.

--

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-07 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 57c50c9c7c701a8301c5a89b2b2d050550f62022 by Christian Heimes in 
branch 'main':
bpo-45723: Add helper macros and more caching to configure.ac (GH-29429)
https://github.com/python/cpython/commit/57c50c9c7c701a8301c5a89b2b2d050550f62022


--

___
Python tracker 

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



[issue45689] Custom Name for ThreadPoolExecutor

2021-11-07 Thread Tangellapalli Sai Hanuma Rahul


Tangellapalli Sai Hanuma Rahul  added the comment:

ThreadPool handles tasks concurrently through Threads so users need not worry 
about the creation/deletion of Threads, it uses reuses threads whenever 
possible and it can handle any tasks. 

However, it should be possible for users to at least name/rename according to 
the tasks that the user submits into the ThreadPool.

Advantages:
* Good for Debugging (so user can know which thread has caused the issue)
* threadName attribute in logging's LogRecord can now use custom Name provided 
to the Task.

Until now thread_name_prefix parameter allows us to name the threads but those 
are not particular to the Task.

Price

previously one could write .submit(function_name, *args, **kwargs)
but now one should write 
.submit(function_name, name_of_thread, *args, **kwargs)
name_of_thread can be None

--

___
Python tracker 

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



[issue45746] ftplib please revisit retrlines('RETR as it produces files without newlines

2021-11-07 Thread Matthew H. McKenzie


Matthew H. McKenzie  added the comment:

On the face of it it is my mistake for using the write method for my file. But 
read on.

your write_line() adds an EOL, OK, because it wraps print().

So the retrlines() function strips them in anticipation?  

The error is arguably in my own code as I am passing write() as the callback 
and it is my fault for not adding line endings back?  Nothing at all wrong with 
write_line as the callback, it echoes perfectly, to the console.

But my files have no EOL.

I need the EOL in my file writes and that is my own problem. It would be maybe 
be an enhancement not to strip them from the host, as it should understand 
ascii as CRLF even if the client is not a CRLF system.

But that adds complexity - it needs to work as is for listings.

My uploaded file was what was being retrieved.

Maybe close this and I'll just do what everybody else does and clone 
retrlines().   

Sorry for your trouble.

--
resolution:  -> wont fix
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



[issue45741] entry points singular?

2021-11-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks for your contribution!

--
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



[issue45741] entry points singular?

2021-11-07 Thread Eric V. Smith


Eric V. Smith  added the comment:


New changeset 77afb76942ea7067d74d9c07fb4da6f5f23ad2f5 by Miss Islington (bot) 
in branch '3.10':
bpo-45741: docs: fix plural (GH-29461) (GH-29463)
https://github.com/python/cpython/commit/77afb76942ea7067d74d9c07fb4da6f5f23ad2f5


--

___
Python tracker 

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



[issue45746] ftplib please revisit retrlines('RETR as it produces files without newlines

2021-11-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please tell us:

- What the file contains, and what you're expecting it to contain.
- What system are you running on?

crap2.txt (the source file) is a single line, so I'm not sure what you're 
expecting to happen.

--
nosy: +eric.smith

___
Python tracker 

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



[issue45741] entry points singular?

2021-11-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27716
pull_request: https://github.com/python/cpython/pull/29463

___
Python tracker 

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



[issue45741] entry points singular?

2021-11-07 Thread miss-islington


miss-islington  added the comment:


New changeset 19b107e9b52dbd73f4c52adcb91e8185a53b45ae by Rafael Fontenelle in 
branch 'main':
bpo-45741: docs: fix plural (GH-29461)
https://github.com/python/cpython/commit/19b107e9b52dbd73f4c52adcb91e8185a53b45ae


--
nosy: +miss-islington

___
Python tracker 

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



[issue45741] entry points singular?

2021-11-07 Thread Rafael Fontenelle


Change by Rafael Fontenelle :


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

___
Python tracker 

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



[issue40139] mimetypes module racy

2021-11-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Without assurance that the problem exists in current python, let alone a 
reproducing code, there is nothing we can do.  If this or a related problem 
occurs again, this can be reopened, or a new issue started.

--
resolution:  -> out of date
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



[issue45712] Typo in "control flow" documentation

2021-11-07 Thread jiahua wang


Change by jiahua wang :


--
keywords: +patch
nosy: +180909
nosy_count: 2.0 -> 3.0
pull_requests: +27714
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29460

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Éric Araujo

Éric Araujo  added the comment:

I think that second PR was linked using the GitHub PR link field present in the 
bug comment form.

--

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

PR-29419 solves the issue in #45717 of not giving a link for _* modules with no 
doc.  It does not solve this issue of giving the proper link for module that 
need non-standard links, which typically need a '#' suffix, as in 
'.../library/2to3.html#module-lib2to3'.  I suggest to continue calculating 
standard links as done now as the precalculation needs much space for a trivial 
time saving.  Restrict the new dict to non-standard links.  They can be 
calculated, with the needed suffixes, as they are now for the index.  The link 
logic would be to try the lookup first and if module name does not start with 
'_', calculate the link.

I will add an idlelib section to idle.rst so that 'idlelib' appears in the 
module index and get entered into the exceptions dict.

I don't see how PR-29459 get linked here as it has no reference to this issue.  
So I will ignore it at least for know.

--
stage: patch review -> test needed

___
Python tracker 

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



[issue45746] ftplib please revisit retrlines('RETR as it produces files without newlines

2021-11-07 Thread Matthew H. McKenzie


New submission from Matthew H. McKenzie :

Lib/ftplib.py  function retrlines

Inspired by documentation the following writes a file without line-endings:
 
from ftplib import FTP
ftp=FTP()
ftp.connect('hostname')
ftp.login('user','')
ftp.sendcmd('pasv')

with open('crap2.txt', 'w') as fp:
ftp.retrlines('RETR crap.txt', fp.write)

Code goes to pains to slice off the line endings, and then print_line does not 
add them back? Apologies if this has been covered before, or I am not following 
the documentation correctly. Not going to suggest a fix as there may be a 
reason it is like this.

For RETR.
For ascii

--
components: Library (Lib)
files: crap2.txt
messages: 405921
nosy: mckenzm
priority: normal
severity: normal
status: open
title: ftplib please revisit retrlines('RETR  as it produces files without 
newlines
versions: Python 3.11
Added file: https://bugs.python.org/file50429/crap2.txt

___
Python tracker 

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



[issue45366] dataclass init=False field with default works but default_factory does not

2021-11-07 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I think a good possible solution is to raise an error if `default_factory` is 
provided on a `init=False` dataclass that doesn't have a `__init__()` defined. 
However, it will create a slight inconsistency because there will be an error 
when `__init__` is not defined, but no error otherwise -- to allow calling the 
factory in custom defined `__init__()`.

The error would be "Error: default_factory argument needs `init=True` to be set 
on dataclass because default_factory value is created in the generated 
__init__() method".

--
nosy: +andrei.avk

___
Python tracker 

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



[issue21436] Consider leaving importlib.abc.Loader.load_module()

2021-11-07 Thread Nick Coghlan


Nick Coghlan  added the comment:

FWIW, I think it would be desirable to retain/restore some form of API that 
allows the creation of modules from files without requiring the user to know 
about module specs (or loaders, or anything else).

My current preference would be for a "module_from_file_location" counterpart to 
"spec_from_file_location" that implements Brett's recipe from above. That code 
is visually short, but conceptually very dense,and hence far from being obvious 
to most people trying to make the "path to module" leap.

Such a function could also cross-reference runpy.run_path for cases where don't 
want a module at all, just the top level namespace.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-07 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Martin: I'm not sure what is the best way to fix this issue, so I hope someone 
else will look into this.

--

___
Python tracker 

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



[issue40051] Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)

2021-11-07 Thread Zachary Ware


Change by Zachary Ware :


--
pull_requests: +27713
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/29459

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

IIUC you're looking for --huntrleaks/-R, not the unrelated --findleaks/-l:

In that -m test -h menu:

  -l, --findleaks   deprecated alias to --fail-env-changed

  -R RUNCOUNTS, --huntrleaks RUNCOUNTS
search for reference leaks (needs debug build, very 
slow). See the section at bottom
for more details.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue45745] ./python -m test --help output for refleaks seems wrong

2021-11-07 Thread Skip Montanaro


New submission from Skip Montanaro :

Just preparing to make a refleaks test run, so I ran:

./python -m test --help

The output related to refleaks seemed suspicious:

...
Special runs:
  -l, --findleaks   deprecated alias to --fail-env-changed
...
  --fail-env-changedif a test file alters the environment, mark the test as 
failed

It's not obvious that "--fail-env-changed" has anything to do with 
"--findleaks". Does the -l/--findleaks message need to be corrected?

--
components: Build
messages: 405916
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: ./python -m test --help output for refleaks seems wrong
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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


Christian Heimes  added the comment:

For reference: 
https://opensource.apple.com/source/ld64/ld64-242/doc/man/man1/ld.1.auto.html

> search_paths_first
> This is now the default (in Xcode4 tools).  When processing -lx the linker 
> now searches each directory
> in its library search paths for `libx.dylib' then `libx.a' before the moving 
> on to the next path
> in the library search path.

According to Wikipedia, Xcode4 was released in 2011.

--

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for the detailed explanation, Ned. Much appreciated! For non-Mac users: 
macOS 10.6 was released in 2009 and 10.9 in 2013. IMHO it is reasonable to ask 
people to provide their own copies of libraries on older system. We also 
require OpenSSL 1.1.1, which is not available on older systems like CentOS 7 
(released 2014).

Regarding pkg-config, I like to tidy up setup.py first to get a better 
understanding what kind of builds and systems I need to support. Thanks for 
pointing out https://github.com/pkgconf/pkgconf! I keep it in mind.

--

___
Python tracker 

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



[issue45644] Make json.tool soak up input before opening output for writing

2021-11-07 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

The proposed path does not work for `python -m json.tool --json-lines test.json 
test.json`. There is also https://github.com/python/cpython/pull/7865 that aims 
to fix this bug but I did not have the time to get back to it.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Ned Deily


Ned Deily  added the comment:

It seems to me that some (most?) of the macOS-specific workarounds in setup.py 
were added to make it easy to build with the system-provided copies of the 
third-party libraries, like zlib and sqlite3 and openssl. At least one of the 
workarounds, search_paths_first, became the default ld behavior since around 
macOS 10.6 (Xcode 4). So when building on more recent macOS systems, either the 
workarounds aren't necessary any more or the third-party library is no longer 
provided (like openssl) or is otherwise too old (like Tk) so that you can no 
longer rely on building with just using system-supplied libraries to have a 
useful Python on macOS. And, if you are building on very old systems (because 
of hardware requirements or whatever), in most cases, the versions of the 
system-supplied libraries are so old that you shouldn't be relying on them 
anyway. So I think that, for 3.11, we could take a stand and say that we no 
longer support building with specific system-supplied third-party libraries
  on macOS systems older than, say, macOS 10.9; IOW, you will need to supply 
your own copies of those libs on older systems. That's essentially the approach 
the MacPorts project has taken for years; they still support providing current 
Pythons on old versions of macOS but they also supply current version of the 
third-party libs, too.

And Christian's work here for 3.11 to move away from setup.py and use 
pkg-config to remove the guesswork on header and lib locations should make life 
easier for everyone. There is a small issue here in that macOS does not supply 
a built-in pkg-config but there are implementations available, if you are 
unable or unwilling to use open source distributors like MacPorts or Homebrew, 
including an actively-maintained permissive-licensed version with no build 
dependencies that seems to work on even macOS 10.6 (I didn't try anything older 
than that!): https://github.com/pkgconf/pkgconf.

Ronald, what do you think?  If this sounds reasonable, we could draw up a list 
of libs and document it somewhere in the 3.11 code.

--

___
Python tracker 

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



[issue41663] Support Windows pseudoterminals in pty and termios modules

2021-11-07 Thread Pradyun Gedam


Pradyun Gedam  added the comment:

https://github.com/spyder-ide/pywinpty might be relevant; although it's 
implemented in Rust.

--
nosy: +pradyunsg

___
Python tracker 

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



[issue45744] Fix Flawfinder C Errors

2021-11-07 Thread Abdur-rahmaan Janhangeer


New submission from Abdur-rahmaan Janhangeer :

Greetings all,

I was doing a security audit using https://dwheeler.com/flawfinder/

There are quite some issues.

Before i PR, i am opening an issue as per the dev guide.

Await further comments. Thanks!

--
messages: 405910
nosy: appinv
priority: normal
severity: normal
status: open
title: Fix Flawfinder C Errors
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



[issue22708] httplib/http.client in method _tunnel used HTTP/1.0 CONNECT method

2021-11-07 Thread Éric Araujo

Change by Éric Araujo :


--
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5, Python 
3.6, Python 3.7

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27712
pull_request: https://github.com/python/cpython/pull/29457

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch, patch
pull_requests: +27710, 27711
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29456

___
Python tracker 

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



[issue45710] Junction/symbolic folder access error on Windows 11

2021-11-07 Thread Eryk Sun


Eryk Sun  added the comment:

All we can do here is document the store app's limitation on cross-volume 
reparse points (junctions, symlinks) in "%UserProfile%\AppData". I suppose it's 
a rare enough problem that it can just be closed as a third-party issue.

--
resolution: works for me -> third party
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



[issue45743] Cleanup and simplify setup.py

2021-11-07 Thread Christian Heimes


New submission from Christian Heimes :

Motivated by deprecation of distutils, I like to move more logic and checks 
from setup.py into configure.ac. Eventually I like to get rid of setup.py. The 
file contains a bunch of complicated checks and macOS-specific adjustments that 
I cannot verify on Linux.


1) socketmodule setup defines __APPLE_USE_RFC_3542 
https://github.com/python/cpython/blob/v3.11.0a2/setup.py#L1229 Can we move the 
define into the __APPLE__ block of socketmodule.c?


2) -Wl,-search_paths_first linker arg, e.g. 
https://github.com/python/cpython/blob/v3.11.0a2/setup.py#L1616  Would it be 
safe to make the option default for all core extensions on $ac_sys_system = 
Darwin? We could add it to PY_CORE_LDFLAGS or add a new Makefile variable for 
core extensions.


3) detect_dbm_gdbm has about 200 lines of complicated code to detect old to 
ancient versions of Berkeley DB (libdb), 
https://github.com/python/cpython/blob/v3.11.0a2/setup.py#L1233 . Can I remove 
support for libdb-3 / libdb-4 and only support libdb-5 in standard locations? 
libdb-5.3 has been around for over a decade.

Note: libdb, gdbm, ndbm, and gdbm-compat don't provide pkg-config .pc files. We 
cannot use pkg-config to detect them.


4) sqlite's setup 
https://github.com/python/cpython/blob/v3.11.0a2/setup.py#L1531 does extra work 
to search for header and library files in non-standard locations. Can we 
replace the code with pkg-config checks in configure.ac with a fallback to 
AC_CHECK_LIB() and AC_CHECK_HEADERS()?


5) zlib's setup code 
https://github.com/python/cpython/blob/v3.11.0a2/setup.py#L1661 has a check for 
a CVE from 2002 (!). I think we can safely assume that everybody has upgraded 
to a fixed version. The check is mixed with macOS specific code.

--
components: Build, macOS
messages: 405908
nosy: christian.heimes, gregory.p.smith, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Cleanup and simplify setup.py
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



[issue45708] PEP 515-style formatting with underscores does not seem to work for Decimal

2021-11-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think your option 2 makes the most sense.

--

___
Python tracker 

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



[issue43073] Adding a ctypes.Union to a ctypes.BigEndianStructure results in an error

2021-11-07 Thread rindeal


rindeal  added the comment:

I have created a workaround, since it might take years to fix this in master. 
Hope it'll come in useful.


For the example in https://bugs.python.org/issue43073#msg385970, but probably 
any combination of Unions and BigEndianStructures can be constructed this way.
```
class U_a(ct.BigEndianStructure):
_pack_ = True
_fields_ = [('a', ct.c_int)]

class U_b(ct.BigEndianStructure):
_pack_ = True
_fields_ = [('b', ct.c_int)]

class U(ct.Union):
_pack_ = True
_fields_ = [
('_a', U_a),
('_b', U_b),
]
_anonymous_ = ['_a', '_b']

class _S_be_fields_only(ct.Structure):
_pack_ = True
_fields_ = [
('_x', ct.c_int),
('y', U),
]
class _S_2be_fields_only(ct.BigEndianStructure):
_pack_ = True
_fields_ = [
('x', ct.c_int),
('_y', ct.c_byte * ct.sizeof(U)),
]

class _S_U(ct.Union):
_pack_ = True
_fields_ = [
('_be_fields_only', _S_be_fields_only),
('_2be_fields_only', _S_2be_fields_only),
]
_anonymous_ = [f[0] for f in _fields_]

class S(ct.Structure):
_pack_ = True
_fields_ = [('_s_u', _S_U)]
_anonymous_ = [_fields_[0][0]]


issubclass(S, ct.Structure) == True
s = S(x=0x11223344, y=U(a=0xaabbccdd))
s.y.a == s.y.b
bytes(s).hex() == "11223344aabbccdd"
```

--
nosy: +rindeal

___
Python tracker 

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



[issue45710] Junction/symbolic folder access error on Windows 11

2021-11-07 Thread Fabio Storino


Fabio Storino  added the comment:

Hello, Eryk. Just to let you know that a regular Python installation was able 
to access my junction folder in AppData and run scripts there.

Thank you for the information on how store apps handle reads/writes in the 
AppData folder.

This is my first bug report. Should I mark this issue as closed?

--
resolution:  -> works for me

___
Python tracker 

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



[issue45742] python -h can't find -R option

2021-11-07 Thread Eryk Sun


Eryk Sun  added the comment:

Either the documentation [1] or the behavior needs to be fixed. The following 
statement is false:

Turn on hash randomization. This option only has an effect if the
PYTHONHASHSEED environment variable is set to 0, since hash
randomization is enabled by default.

---
[1] https://docs.python.org/3.10/using/cmdline.html#cmdoption-R

--

___
Python tracker 

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



[issue45742] python -h can't find -R option

2021-11-07 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



[issue45742] python -h can't find -R option

2021-11-07 Thread Eryk Sun


Eryk Sun  added the comment:

Apparently -R is still implemented in Python 3, even though hash randomization 
is enabled by default now. Unlike Python 2, in Python 3 -R overrides the 
PYTHONHASHSEED environment variable, making it effectively the same as 
"PYTHONHASHSEED=random". For example:

Python 2.7.18

$ PYTHONHASHSEED=37 python2
>>> import sys; sys.flags.hash_randomization
37
>>> hash('spam')
-3063226141675644153

$ PYTHONHASHSEED=37 python2 -R
>>> import sys; sys.flags.hash_randomization
37
>>> hash('spam')
-3063226141675644153

Python 3.11

$ PYTHONHASHSEED=37 python3 -q
>>> import sys; sys.flags.hash_randomization
1
>>> hash('spam')
7085596773562191897

$ PYTHONHASHSEED=37 python3 -q
>>> hash('spam')
7085596773562191897

$ PYTHONHASHSEED=37 python3 -qR
>>> import sys; sys.flags.hash_randomization
1
>>> hash('spam')
-6544739063919843911

$ PYTHONHASHSEED=37 python3 -qR
>>> hash('spam')
5363435507110042548

Python 3 no longer reports the seed value in sys.flags.hash_randomization, so I 
repeated the 3.11 examples twice to show that PYTHONHASHSEED works, except when 
-R overrides it.

--
nosy: +eryksun -180909

___
Python tracker 

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



[issue45741] entry points singular?

2021-11-07 Thread Eric V. Smith

Eric V. Smith  added the comment:

I think “provide” would be better.

--
keywords: +easy
nosy: +eric.smith

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-07 Thread Eric V. Smith

Eric V. Smith  added the comment:

I don’t think “N” should be supported. It was never the intention to have it 
work.

--

___
Python tracker 

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



[issue45724] Segmentation fault

2021-11-07 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> third party
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



[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Irit Katriel

Irit Katriel  added the comment:

I see what you mean. I think it's ok in traceback.py to reject an exception 
clone which is not an instance of BaseException. I agree this should not be 
backported. You could make that explicit by adding a few words to this sentence 
in the doc, to make it about the exc value as well as the traceback:

"The module uses traceback objects — this is the object type that is stored in 
the sys.last_traceback variable and returned as the third item from 
sys.exc_info()."

(https://docs.python.org/3/library/traceback.html)

The C code fix doesn't need to be backported either - this issue is not 
something a user had a problem with, we found it through test coverage.

--

___
Python tracker 

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



[issue42369] Reading ZipFile not thread-safe

2021-11-07 Thread Spencer Brown


Change by Spencer Brown :


--
nosy: +Spencer Brown

___
Python tracker 

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



[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Nikita Sobolev

Nikita Sobolev  added the comment:

1. Thanks! Yes, this is exactly the case I am talking about.

Right now, this test won't pass:

```
def test_print_exception_bad_type_python(self):
with self.assertRaises(TypeError):
traceback.print_exception(42)
```

Why? Because we don't type check the argument to be `Exception` subtype.
It fails with `AttributeError`. And my question is more like: should we?

I have several opposing thoughts:
- Most likely it is always used with `Exception`. I am pretty sure that
re-implementing exceptions is not something you would do. And it will be in
sync with C code.
- But, on the other hand, it is a breaking change.

вс, 7 нояб. 2021 г. в 13:37, Irit Katriel :

>
> Irit Katriel  added the comment:
>
> 1. I don't think we need such a clone of exception. We just need something
> like these two tests:
>
> @cpython_only
> def test_print_exception_bad_type_ct(self):
> with self.assertRaises(TypeError):
> from _testcapi import exception_print
> exception_print(42)
>
> def test_print_exception_bad_type_python(self):
> with self.assertRaises(TypeError):
> traceback.print_exception(42)
>
> It could be that they don't fit in BaseExceptionReportingTests because
> that is for tests that use get_report. It's fine of they are added
> separately. The python one can come after test_exception_is_None, and the C
> one perhaps after test_unhashable (and their names should be slightly
> different than above).
>
>
> 2. _testcapi is how you call into print_exception directly (for testing).
> If I remove the type check in _testcapi then the test above segfaults with
>
> Assertion failed: (PyExceptionInstance_Check(exc)), function
> _PyBaseExceptionObject_cast, file exceptions.c, line 321.
>
>
> This issue was created because Erlend found that the type check in
> print_exception is not covered by tests. It's possible that this check is
> in the wrong place at the moment.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Interesting. I think the behaviour of the Python implementation behaviour is 
actually more correct here: neither `int` nor `float` supports 'N', and I'm not 
seeing any indication in tests or documentation that 'N' should be supported. 
So is this a bug in libmpdec, or a missing feature in the Python 
implementation? (Either way, it's definitely a bug that the two aren't aligned.)

>>> format(123, 'n')
'123'
>>> format(123, 'N')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Unknown format code 'N' for object of type 'int'

--
nosy: +eric.smith

___
Python tracker 

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



[issue45615] Missing test for type of error when printing traceback for non-exception

2021-11-07 Thread Irit Katriel


Irit Katriel  added the comment:

1. I don't think we need such a clone of exception. We just need something like 
these two tests:

@cpython_only
def test_print_exception_bad_type_ct(self):
with self.assertRaises(TypeError):
from _testcapi import exception_print
exception_print(42)

def test_print_exception_bad_type_python(self):
with self.assertRaises(TypeError):
traceback.print_exception(42)

It could be that they don't fit in BaseExceptionReportingTests because that is 
for tests that use get_report. It's fine of they are added separately. The 
python one can come after test_exception_is_None, and the C one perhaps after 
test_unhashable (and their names should be slightly different than above).


2. _testcapi is how you call into print_exception directly (for testing). If I 
remove the type check in _testcapi then the test above segfaults with

Assertion failed: (PyExceptionInstance_Check(exc)), function 
_PyBaseExceptionObject_cast, file exceptions.c, line 321.


This issue was created because Erlend found that the type check in 
print_exception is not covered by tests. It's possible that this check is in 
the wrong place at the moment.

--

___
Python tracker 

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



[issue45723] Improve and simplify configure.ac checks

2021-11-07 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset be3cd5c05d9fb1d1cdb55cb98ca6ef8f866774be by Christian Heimes in 
branch 'main':
bpo-45723: Detect missing pkg-config (GH-29442)
https://github.com/python/cpython/commit/be3cd5c05d9fb1d1cdb55cb98ca6ef8f866774be


--

___
Python tracker 

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



[issue45708] PEP 515-style formatting with underscores does not seem to work for Decimal

2021-11-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Christian Heimes pointed out in the PR discussion that we can't simply modify 
libmpdec, since some vendors unbundle the mpdecimal library.

So some options are:

0. Do nothing.
1. Request that this feature to be added upstream, so that it eventually makes 
its way into core Python.
2. Bypass mpd_parse_fmt_str and do our own format string parsing in _decimal.c 
(e.g., by copying and adapting the code in mpdecimal).
3. Wrap mpd_parse_fmt_str and do our own pre- and post- processing in 
_decimal.c (pre-process to convert "_" to "," in the format string, then 
post-process the formatted string to convert "," back to "_").

Option 2 makes sense to me from the point of view of separation of concerns: 
libmpdec aims to implement Cowlishaw's specification, and formatting lies 
outside of that specification. The decimal specification is pretty much set in 
stone, but the formatting mini-language could change again in the future, and 
when that happens we should be able to update the CPython code accordingly. 
(This brings to mind Robert Martin's Single Responsibility Principle: "Gather 
together those things that change for the same reason, and separate those 
things that change for different reasons.") 

I've updated the PR (and turned it into a draft) to show what option 2 looks 
like. The duplication is a little ugly.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue41544] multiprocessing.dummy.Process lacks daemon parameter

2021-11-07 Thread Martin


Martin  added the comment:

Could someone have a look at my pull request? I have trouble with the tests.

--

___
Python tracker 

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



[issue41544] multiprocessing.dummy.Process lacks daemon parameter

2021-11-07 Thread Martin


Change by Martin :


--
nosy: +davin, pitrou
type:  -> behavior

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-11-07 Thread Martin


Martin  added the comment:

Could the participants of this issue please have a look at my pull request:

https://github.com/python/cpython/pull/29299

What do you like, what don't you like? Does it work for your use case?

--

___
Python tracker 

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