[issue32553] Use the py launcher in venv Windows examples

2021-03-16 Thread Eryk Sun


Change by Eryk Sun :


--
title: venv says to use python3 which does not exist in 3.6.4 -> Use the py 
launcher in venv Windows examples
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue38890] subprocess.Popen should not emit a ResourceWarning for a detached process

2021-03-16 Thread Eryk Sun


Eryk Sun  added the comment:

I wonder if this should be handled more productively by supporting a `daemon` 
parameter. In POSIX, use the double fork technique for creating a daemon 
process. In Windows, use DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP | 
CREATE_BREAKAWAY_FROM_JOB. For a daemon process, the finalizer would not emit a 
resource warning or add it to the _active list.

--
title: A subprocess.Popen created with creationFlags=DETACHED_PROCESS on 
Windows should not emit a ResourceWarning -> subprocess.Popen should not emit a 
ResourceWarning for a detached process
versions: +Python 3.10 -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



[issue43525] pathlib: Highlight pathlib operator behavior with anchored paths

2021-03-16 Thread diegoe


Change by diegoe :


--
title: pathlib: Highlight operator behavior with anchored paths -> pathlib: 
Highlight pathlib operator behavior with anchored paths

___
Python tracker 

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



[issue43525] pathlib: Highlight operator behavior with anchored paths

2021-03-16 Thread diegoe


Change by diegoe :


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

___
Python tracker 

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



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-16 Thread Ned Deily


Ned Deily  added the comment:

Thanks for submitting a very interesting issue! tkinter/Tk performance is not 
something we normally pay a lot of attention to. I did not attempt to run your 
application but I was able to see significant performance differences with your 
simple "help('modules') test. Before saying more, I want to test some 
additional configurations but I've run out of time for today. However, the 
differences don't seem to have anything to do with running on new M1 Macs as I 
was able to see them on a traditional Intel-based Mac running macOS 11.

--
title: Tk 8.6.11 slow on M1 Mac Mini MacOS Python 3.9.2 native ARM version -> 
tkinter with Tk 8.6.11 is slow on macOS

___
Python tracker 

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



[issue43525] pathlib: Highlight operator behavior with anchored paths

2021-03-16 Thread diegoe


New submission from diegoe :

In the '/' operator documentation for `pathlib`, the behavior for anchored 
paths is not described:

https://docs.python.org/3/library/pathlib.html#operators

The behavior (prefer the second/right-hand root/anchor) is only explained in 
the `PurePath` class:

https://docs.python.org/3/library/pathlib.html#pathlib.PurePath

I ran into this while helping migrate a code base that was using "naive" 
concatenation of strings, so this:

```
PROJECT_DIR = ROOT_DIR + "/project-name"
```

was migrated to:
```
PROJECT_DIR = ROOT_DIR / "/project-name"
```

Note that, of course, we missed the leading "/".

Although the docs _do_ describe the behavior somewhere else, I believe it's 
worth being redundant in the operator section.

I believe it's a reasonable mistake to warn new users against, specially since 
"naive" concatenation is a common "ugly" pattern that many would be migrating 
from. Plus, a leading "/" is easy to miss, which would only compound the 
confusion if you are seeing your path "omit the (left-hand) Path object" 
(because the anchored string took precedence).

--
assignee: docs@python
components: Documentation
messages: 388904
nosy: diegoe, docs@python
priority: normal
severity: normal
status: open
title: pathlib: Highlight operator behavior with anchored paths
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



Universal compiler that runs Java, Ruby, C++, and Python in a single VM

2021-03-16 Thread James Lu
It's called Oracle's Truffle. Truffle runs all those languages with an
autogenerated JIT.

This is my response to the neos drama.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue15533] subprocess.Popen(cwd) documentation: Posix vs Windows

2021-03-16 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

For our subprocess docs, Eryk's text:

"""
For POSIX, ``executable`` should be stated as a "relative path without a slash 
in it" or a "relative path without a directory in it". An unqualified filename 
is a relative path that won't be resolved against ``cwd``, unless there's a "." 
entry in PATH.

For Windows, the use of CreateProcess() is documented. It could be stated more 
explicitly that ``executable``, ``args`` / ``list2cmdline(args)``, ``env``, and 
``cwd`` are passed directly to CreateProcess() as lpApplicationName, 
lpCommandLine, lpEnvironment, and lpCurrentDirectory.
"""

is quite reasonable.  I wouldn't include your long notes.  But a link to a MSDN 
article explaining that would be useful at the end of the Windows paragraph.

For the POSIX case we should describe which PATH is used.  The current one, or 
the one set in a ``env`` dict.

--

___
Python tracker 

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



[issue15533] subprocess.Popen(cwd) documentation: Posix vs Windows

2021-03-16 Thread Eryk Sun


Eryk Sun  added the comment:

> Python is conceptually multi-platform, so its behavior on 
> Linux and Windows should be as much consistent as possible.

It's not expected for the behavior of all Popen() parameters to be the same on 
all platforms. For example, the behavior and capabilities of shell=True are 
different in Windows vs POSIX. But I think a basic set of parameters should 
have been singled out for cross-platform consistency -- at least in the default 
case. Unfortunately it wasn't designed that way. New behavior that's consistent 
with POSIX can be implemented, but at this point it would have to be enabled by 
a parameter. 

> "In particular, the function looks for executable (or for the 
> first item in args) relative to cwd if the executable path is 
> a relative path." 

For POSIX, this should be stated as a "relative path without a slash in it" or 
a "relative path without a directory in it". An unqualified filename is a 
relative path that won't be resolved against `cwd`, unless there's a "." entry 
in PATH.

For Windows, the use of CreateProcess() is documented. It could be stated more 
explicitly that `executable`, `args` / list2cmdline(args), `env`, and `cwd` are 
passed directly to CreateProcess() as lpApplicationName, lpCommandLine, 
lpEnvironment, and lpCurrentDirectory.

Here are some notes and corrections about the documentation of lpCommandLine, 
in particular the following paragraph:

If the file name does not contain an extension, .exe is appended.
Therefore, if the file name extension is .com, this parameter must
include the .com extension. If the file name ends in a period (.)
with no extension, or if the file name contains a path, .exe is
not appended. If the file name does not contain a directory path,
the system searches for the executable file in the following
sequence [1][2][3]:

* %__APPDIR__%
* %__CD__% [4]
* %SystemRoot%\System32
* %SystemRoot%\System
* %SystemRoot%
* %PATH% (machine/user extended search sequence)

[1] The search sequence is rewritten here succinctly using
environment variables in the current process, including the
virtual variables __APPDIR__ (application directory) and
__CD__ (current directory), which are supported by WinAPI
GetEnvironmentVariableW().

[2] A path name is resolved by searching for it if it isn't fully
qualified and doesn't explicitly begin with the current
directory (".") or its parent (".."). Note that, unlike POSIX,
a relative path name is resolved by searching for it even if
it contains a directory component (i.e. a slash or backslash).
For example, "spam\eggs.exe" is resolved by looking for
r"%__APPDIR__%\spam\eggs.exe" and so on.

[3] If a path name has to be resolved by searching, and its final
component does not contain a "." character, then ".exe" is
appended to the name. On the other hand, if a path name does
not need to be resolved by searching, because it's fully
qualified or the first component is "." or "..", then if the 
given path name doesn't exist, it also looks for the name with
".exe" appended, even if the final component of the path name
contains a "." character.

[4] If "NoDefaultCurrentDirectoryInExePath" is defined in the
environment and the path name does not contain a directory
component (i.e. no slash or backslash), then the current
directory is excluded from the search sequence.

That %__APPDIR__% always takes precedence means that 
subprocess.Popen(['python']) runs the Python version of the current process, 
regardless of PATH, unless shell=True is used. 

The implementation of lpApplicationName (executable) and lpCurrentDirectory 
(cwd) means that argv[0] in the child process, as parsed from its command line, 
does not necessarily resolve to a name in the filesystem. Windows supports 
GetModuleFileNameW(NULL, ...) to get the path of the application executable.

--
versions: +Python 3.10, Python 3.9 -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



[issue43477] from x import * behavior inconsistent between module types.

2021-03-16 Thread Thomas J. Gallen


Thomas J. Gallen  added the comment:

Given the previous example, in test.py, replace:

```
print(test_module.test_submodule)
```

...with:

```
assert(not hasattr(test_module, "test_submodule"))
```

...because the issue is only the bottom half of `_find_and_load_unlocked`. 
Specifically, the chunk starting at line 1006:

```
if parent:
# Set the module as an attribute on its parent.
parent_module = sys.modules[parent]
child = name.rpartition('.')[2]
try:
setattr(parent_module, child, module)
except AttributeError:
msg = f"Cannot set an attribute on {parent!r} for child module 
{child!r}"
_warnings.warn(msg, ImportWarning)
```

The issue with these lines is that nothing here was requested by the user, and 
the actions you mentioned (preventing redundant/duplicate imports) is not 
handled by anything in, or relating to this code (at least, not that I've 
seen.) The module and all dependencies would still be loaded into `sys.modules` 
despite this code. If the module has already been loaded, then we'll never make 
it past `_find_and_load` to `_find_and_load_unlocked` anyway, as 
`_NEEDS_LOADING` will no longer match.

Does that make more sense?

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

___
Python tracker 

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



[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-16 Thread Greg Darke


Change by Greg Darke :


--
resolution:  -> fixed

___
Python tracker 

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



[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

PEP 626 deprecates co_lnotab, co_lnotab:

https://www.python.org/dev/peps/pep-0626/#id15

This doesn't seem to be mentioned in the What's new document and is quite 
important. Mark, do you mind creating a PR for this? I could do it and add you 
as a reviewer if you wish

--

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I agree we should be careful here. There are several things to consider:

* Macros transformed into function may or may not get inlined so there is a 
risk of affecting performance if we just transform them in bulk.

* Because the macro is defined as 'static inline' in the header file, then it 
*can* be inlined everywhere if the compiled decides to do it. It will be one 
copy symbol in the text segment on every compilation unit. Notice that 'inline' 
has a special meaning in C99 and it doesn't only mean "inline this function". 
It has visibility implications (see section 6.7.4 of the C99 standard).

* There is risk to introducing a backwards-incompatible ABI change by mistake 
as Victor mentions.

* This can affect also the link patterns of extension modules because these 
symbols may be visible in the resulting binaries when they were 
macro-level-inlined before. I cannot see any problem that can happen because of 
this but we should carefully consider it.

In short, there is the value of converting these macros for extra type safety, 
but we need to at the very least be very careful and if we decide to go forward 
this needs as many reviews as possible so we don't miss anything. I would 
recommend maybe start a thread about this in python-dev.

--

___
Python tracker 

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



[issue43524] Addition of peek and peekexactly methods to asyncio.StreamReader

2021-03-16 Thread Awal Garg


Awal Garg  added the comment:

P.S., I've filed this issue after a brief discussion in #python and following 
this ticket https://bugs.python.org/issue32052 which asks for exposing the 
internal buffer as is. Obviously, peek methods don't need to expose the buffer 
and only provide a readonly view.

--

___
Python tracker 

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



[issue43516] python on raspberry pi

2021-03-16 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Yann,

Eric is correct -- this isn't a help desk. Please ask your question on one of 
the many forums available for asking help, but before you do, please read:

http://www.sscce.org/

https://stackoverflow.com/help/minimal-reproducible-example

and remember to let them know what you expected the code to do and what it did 
instead.

You'll also need to tell them the version of Python you are running, and 
clarify whether you are running on a Raspberry Pi (as the title says) or 
Android (as the code says).

--
nosy: +steven.daprano
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



[issue43523] Handling Ctrl+C while waiting on I/O in Windows

2021-03-16 Thread Eryk Sun


Eryk Sun  added the comment:

winrshost.exe runs Python with its standard I/O redirected to pipes, so 
sys.stdin.read(1) blocks the main thread while waiting for the synchronous read 
to complete. If the user types something, then the read completes and the main 
thread can call the SIGINT handler, which raises KeyboardInterrupt.

By default, SIGBREAK is not handled, so the console CTRL_BREAK_EVENT executes 
the default handler on the control thread, which calls 
ExitProcess(STATUS_CONTROL_C_EXIT).

Currently, the only I/O that can be interrupted is reading from console input, 
since the console itself cancels the request when the user presses Ctrl+C.

To interrupt synchronous I/O in general, the C signal handler could call WinAPI 
CancelSynchronousIo() with a handle for the main thread. Synchronous I/O calls 
would have to be updated to handle ERROR_OPERATION_ABORTED (from C _doserrno if 
calling C read/write). This entails calling PyErr_CheckSignals() in order to 
call the registered signal handler and return whether it raises an exception. 
But first PyOS_InterruptOccurred() has to be checked. If SIGINT isn't tripped, 
the abort request didn't originate from the signal handler, so the call should 
fail without calling PyErr_CheckSignals().

An asynchronous I/O request (e.g. socket I/O is typically asynchronous) can be 
canceled with CancelIo[Ex], which requires a handle for the open file that has 
the pending request. This case can only be addressed by the C signal handler if 
the main thread registers the file handle with the signal module before waiting 
for I/O completion. If a wait for I/O completion is alertable, then a user-mode 
APC can be queued to the thread in order to call CancelIo() on the file handle. 
If it's not an alertable wait, then the I/O request can be canceled with 
CancelIoEx(), but preferably the OVERLAPPED record for the request should also 
be registered, else all of the file's pending I/O requests will be canceled, 
instead of canceling only the request that's blocking the main thread.

--
components: +IO, Interpreter Core, Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
title: Handling Ctrl+C when waiting on stdin on Windows via winrs -> Handling 
Ctrl+C while waiting on I/O in Windows
type:  -> enhancement
versions: +Python 3.10, Python 3.8

___
Python tracker 

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



[issue43524] Addition of peek and peekexactly methods to asyncio.StreamReader

2021-03-16 Thread Awal Garg


New submission from Awal Garg :

I propose the addition of the following methods to asyncio.StreamReader:

> coroutine peek(n=-1)
> Same as read, but does not remove the returned data from the internal buffer.
> 
> coroutine peekexactly(n)
> Same as readexactly, but does not remove the returned data from the internal 
> buffer.

My use case is to multiplex a few protocols over a single TCP socket, for which 
I need to non-destructively read a few bytes from the socket to decide which 
parser to hand the stream over to.

Thoughts?

--
components: asyncio
messages: 388895
nosy: asvetlov, awalgarg, yselivanov
priority: normal
severity: normal
status: open
title: Addition of peek and peekexactly methods to asyncio.StreamReader
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



[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2021-03-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Shouldn't this wait to see if the subinterpreters PEP is approved?  Because if 
it isn't, then no chance should be made.  We shouldn't change something this 
fundamental without good cause.

--
nosy: +pablogsal, rhettinger

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Be careful about performance.  We know for sure that macros will inline.  In 
contrast, inline functions might or might not inline (there are rules for when 
it can be done).  When applied across source files, inlining often only occurs 
with an LTO build — any other build can't inline across object files.  
Historically, we've never had to depend on LTO, so that would be a regression 
for some users.  We've already have a performance bug that needed to be 
reverted because of too aggressive conversion of macros to inline functions.  

A problem with these blanket PRs is that they second guess the original 
developer who may have made a conscious and informed decision to use a macro.  
If you really think that developer was wrong, they should be included in the 
conversation and given the chance to opt in or out.  Otherwise, we're 
mechanically undoing previous intelligent efforts.

Ideally, there needs to be a more nuanced view than "macros are bad, inline 
functions are good".

--
nosy: +pablogsal, rhettinger

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I think we should stick the with forward slashes.  That is what the rest of the 
language does.  Adding more options is recipe for confusion.

>>> 38 / 5
7.6
>>> 38 ∕ 5
SyntaxError: invalid character '∕' (U+2215)

--
nosy: +rhettinger

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-16 Thread Cebtenzzre


Change by Cebtenzzre :


--
nosy: +cebtenzzre

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-16 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the PRs and the What's New entries.

--
assignee: ned.deily -> 
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



[issue43523] Handling Ctrl+C when waiting on stdin on Windows via winrs

2021-03-16 Thread George Sovetov


New submission from George Sovetov :

Ctrl+C alone has no effect, but Ctrl+Break works:
```
winrs -r:127.0.0.1:20465 -u:Administrator -p:qweasd123 python -c "import 
sys;sys.stdin.read(1)"
```
Although, if I press Ctrl+C, type zero or more symbols and then press Enter, 
KeyboardInterrupt is raised:
```
lalala
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Program Files\Python39\lib\encodings\cp1252.py", line 22, in decode
def decode(self, input, final=False):
KeyboardInterrupt
^C^C
```

With the following commands, both Ctrl+C and Ctrl+Break work:
```
winrs -r:127.0.0.1:20465 -u:Administrator -p:qweasd123 python -c "import 
time;time.sleep(10)"
"c:\Program Files\Python39\python.exe" -c "import sys; sys.stdin.read(1)"
"c:\Program Files\Python39\python.exe" -c "import time;time.sleep(10)"
```

I faced this issue when working with WSMV (Windows remoting API) directly, but 
I reproduced this with winrs to make sure it's not a bug in my code. I send the 
Ctrl+C signal, got a no-error response, then poll the running command. It 
behaves as if a signal had no effect.

--
messages: 388890
nosy: sovetov
priority: normal
severity: normal
status: open
title: Handling Ctrl+C when waiting on stdin on Windows via winrs
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



[issue43334] venv does not install libpython

2021-03-16 Thread Christian Heimes


Christian Heimes  added the comment:

This sounds like a bug in CMake or Make. Are you using any CMake plugins or 
autoconf/automake macros? It's very well possible that the author of these 
extension made a wrong assumption or the extension was written before venvs 
were introduced.

--

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Christian Heimes


Christian Heimes  added the comment:

PS: I don't see any remark or warning about the behavior on the man pages 
https://www.openssl.org/docs/man1.1.1/man3/X509_VERIFY_PARAM_set_flags.html and 
https://www.openssl.org/docs/man1.1.1/man3/X509_check_host.html

--

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Christian Heimes


Christian Heimes  added the comment:

Oh heck, this is a genuine bug. I'm not yet sure if it's an undocumented API 
quirk in OpenSSL, a design bug in OpenSSL, or a bug in my code.

Python sets the host flags on the X509_VERIFY_PARAM of the *SSL_CTX. All flags 
get copied to *SSL struct and later to *X509_STORE_CTX struct. At least I 
thought that all flags get copied. Apparently hostflags aren't copied from 
*SSL_CTX to *SSL because the *SSL_CTX doesn't have any verify hosts configured. 
They are only ever configured on *SSL struct.

https://github.com/openssl/openssl/blob/081a7061f3da07318c4b0f5de67b82285630bf6b/crypto/x509/x509_vpm.c#L202-L213

--

___
Python tracker 

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



Re: file location/directory

2021-03-16 Thread dn via Python-list
On 17/03/2021 02.02, Gys wrote:
> On 3/14/21 7:44 PM, Quentin Bock wrote:
>> how can I change the path that python takes to run certain files, I'm
>> starting to create game and I want those in separate folders, so how
>> can I
>> change it so that python runs the program with the files from that
>> folder?


> this is a very dense subject. The simplest sulution is to create a

+1


> MainFolder with the main module of your game. Then in that folder,
> create a SubFolder where you can store the modules your game wants to
> import.

+1
- and start the game from "MainFolder", ie make that the "current
working directory".


> The alternative is to use the Environment variable $PYTHONPATH

Why not manipulate os.path directly instead of using $PYTHONPATH?
(this might turn into a philosophical discussion...)


> Setting Your PYTHONPATH environment variable (Linux/Unix/OsX)
> 
> Open your personal .bashrc file at /home//.bashrc

The above assumes a *nux OpSys. That being an aspect of the "dense
subject"! If you (OP) intend to distribute this game to other
users/systems, then it is important to be aware of the myriad
differences and 'gotchas'.

Another such challenge is to ensure that everything-needed will be
included in the s/w-delivery - it is very easy to manually copy-over one
directory, but equally easy to forget some (non-sub-directory) companion
library.

In the case of $PYTHONPATH, you will either have to provide a mechanism
to install such for your users, or ask them to do it manually!

(hint: users want to play the game, so don't expect them to be *nix
command-line experts)
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson

Carl Anderson  added the comment:

I guess if we are doing slashes, then the division sign ÷ (U+00F7) should be 
included too. 

There are at least 2 minus signs too (U+002D, U+02D7).

--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-16 Thread Ned Deily


Ned Deily  added the comment:


New changeset 79373951b3eab585d42e0f0ab83718cbe1d0ee33 by Miss Islington (bot) 
in branch '3.7':
[3.7] bpo-43285 Make ftplib not trust the PASV response. (GH-24838) (GH-24881) 
(GH-24883)
https://github.com/python/cpython/commit/79373951b3eab585d42e0f0ab83718cbe1d0ee33


--

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Ezio Melotti


Change by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue43334] venv does not install libpython

2021-03-16 Thread Anup Parikh


Anup Parikh  added the comment:

I'm seeing this issue in a third-party package that uses CMake and Make based 
build systems rather then setuptools (it's a mostly C library which 
additionally provides some python wrappers). Those build systems can normally 
parse a python installation with the standard directory structure to find the 
library and headers, but fail on a venv. I can bring this up with the package 
developers, but I don't see any downsides to linking the headers/libraries in 
the venv to make it easy to use.

Regarding the comment that venv's are primarily for runtime, I didn't see 
anything in PEP 405 that supports that statement. And in any case, even for 
runtime environments, installing a python package from a source distribution is 
valid, right? So shouldn't the venv support building extensions?

Again, I agree that third party packages that provide python wrappers should 
probably use standard tools (i.e., setuptools) to build the python C 
extensions, but I fail to see the downsides to including links to the 
headers/libraries in the venv for ease of use.

--
status: closed -> open

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson

Carl Anderson  added the comment:

from https://en.wikipedia.org/wiki/Slash_(punctuation) there is

U+002F / SOLIDUS
U+2044 ⁄ FRACTION SLASH
U+2215 ∕ DIVISION SLASH
U+29F8 ⧸ BIG SOLIDUS
U+FF0F / FULLWIDTH SOLIDUS (fullwidth version of solidus)
U+1F67C  VERY HEAVY SOLIDUS

In XML and HTML, the slash can also be represented with the character entity 
 or  or .[42]

there are a couple more listed here:

https://unicode-search.net/unicode-namesearch.pl?term=SLASH

--

___
Python tracker 

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



[issue43285] ftplib should not use the host from the PASV response

2021-03-16 Thread Ned Deily


Ned Deily  added the comment:


New changeset 4134f154ae2f621f25c5d698cc0f1748035a1b88 by Miss Islington (bot) 
in branch '3.6':
[3.6] bpo-43285 Make ftplib not trust the PASV response. (GH-24838) (GH-24881) 
(GH-24882)
https://github.com/python/cpython/commit/4134f154ae2f621f25c5d698cc0f1748035a1b88


--

___
Python tracker 

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



Re: How do I read .csv files

2021-03-16 Thread Alan Gauld via Python-list
On 16/03/2021 16:15, The Cool Life wrote:
> Try importing the CSV module. That might help!
And for the removal of doubt it is spelled csv 9lower case)

And it looks like you want to read about the DictReader
class within it.

The csv module docs include several examples.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo


Matthew Suozzo  added the comment:

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

--

___
Python tracker 

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



[issue43514] Disallow fork in a subinterpreter affects multiprocessing plugin

2021-03-16 Thread Frank Ueberschar


Frank Ueberschar  added the comment:

These lines correspond (due to dirty working copy): 

File 
"/home/franku/git/bareos/master/core/src/plugins/filed/python/libcloud/BareosLibcloudApi.py",
 line 102 in __init__

The actual Python code that starts the child processes is here:
https://github.com/bareos/bareos/blob/fb76608092ba204ce43cd7c262619e01f9d6a2d6/core/src/plugins/filed/python/libcloud/BareosLibcloudApi.py#L110

--

___
Python tracker 

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



[issue43478] Disallow Mock spec arguments from being Mocks

2021-03-16 Thread Matthew Suozzo


Matthew Suozzo  added the comment:

A few more things:

Assertions on Mock-autospec'ed Mocks will silently pass since e.g. 
assert_called_once_with will now be mocked out. This may justify a more 
stringent stance on the pattern since it risks hiding real test failures.

One complicating factor with the implementation is that autospec'd objects may 
have children that are already Mocked out. Failing eagerly, however, would 
break cases where the child is never used (and consequently risk causing more 
friction than may be necessary) but failing only upon access of that child 
makes it trickier for the user to trace back to where the parent was mocked.

--

___
Python tracker 

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



[issue43514] Disallow fork in a subinterpreter affects multiprocessing plugin

2021-03-16 Thread Frank Ueberschar


Frank Ueberschar  added the comment:

Initialization of the Python interpreter in C-code is here: 
https://github.com/bareos/bareos/blob/fb76608092ba204ce43cd7c262619e01f9d6a2d6/core/src/plugins/filed/python/python-fd.cc#L189

The actual Python code that starts the child processes is here:
https://github.com/bareos/bareos/blob/fb76608092ba204ce43cd7c262619e01f9d6a2d6/core/src/plugins/filed/python/libcloud/BareosLibcloudApi.py#L110

Where this is one of the actual Processes: 
https://github.com/bareos/bareos/blob/fb76608092ba204ce43cd7c262619e01f9d6a2d6/core/src/plugins/filed/python/libcloud/bareos_libcloud_api/bucket_explorer.py#L45

Inherited from this base class: 
https://github.com/bareos/bareos/blob/fb76608092ba204ce43cd7c262619e01f9d6a2d6/core/src/plugins/filed/python/libcloud/bareos_libcloud_api/process_base.py#L36

--

___
Python tracker 

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



[issue43514] Disallow fork in a subinterpreter affects multiprocessing plugin

2021-03-16 Thread Frank Ueberschar


Frank Ueberschar  added the comment:

Here is part of the gdb backtrace:

[franku@franku py3plug-fd-libcloud]$ sbin/bareos_fd-py3plug-fd-libcloud -f -c 
etc/bareos   
Fatal Python error: _PyInterpreterState_DeleteExceptMain: not main interpreter
Python runtime state: initialized

Current thread 0x7f0dc2ab7640 (most recent call first):
  File "/usr/lib64/python3.9/multiprocessing/popen_fork.py", line 66 in _launch
  File "/usr/lib64/python3.9/multiprocessing/popen_fork.py", line 19 in __init__
  File "/usr/lib64/python3.9/multiprocessing/context.py", line 277 in _Popen
  File "/usr/lib64/python3.9/multiprocessing/context.py", line 224 in _Popen
  File "/usr/lib64/python3.9/multiprocessing/process.py", line 121 in start
  File 
"/home/franku/git/bareos/master/core/src/plugins/filed/python/libcloud/BareosLibcloudApi.py",
 line 102 in __init__
  File 
"/home/franku/git/bareos/master/core/src/plugins/filed/python/libcloud/BareosFdPluginLibcloud.py",
 line 267 in start_backup_job
  File 
"/home/franku/git/bareos/master/core/src/plugins/filed/python/pyfiles/BareosFdPluginBaseclass.py",
 line 285 in handle_plugin_event
  File 
"/home/franku/git/bareos/master/core/src/plugins/filed/python/pyfiles/BareosFdWrapper.py",
 line 38 in handle_plugin_event
Fatal Python error: _PyInterpreterState_DeleteExceptMain: not main interpreter
Python runtime state: initialized

--

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Quentin Pradet


Change by Quentin Pradet :


Added file: https://bugs.python.org/file49883/server.key

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Quentin Pradet


Change by Quentin Pradet :


Added file: https://bugs.python.org/file49881/client.pem

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Quentin Pradet


Change by Quentin Pradet :


Added file: https://bugs.python.org/file49882/server.pem

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Quentin Pradet


Change by Quentin Pradet :


Added file: https://bugs.python.org/file49880/app.py

___
Python tracker 

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



[issue43522] SSLContext.hostname_checks_common_name appears to have no effect

2021-03-16 Thread Quentin Pradet


New submission from Quentin Pradet :

urllib3 is preparing a v2 with various SSL improvements, such as leaning on the 
ssl module to match hostnames when possible and reject certificates without a 
SAN. See 
https://urllib3.readthedocs.io/en/latest/v2-roadmap.html#modern-security-by-default
 for more details.

For this reason, we want to set `hostname_checks_common_name` to False on 
Python 3.7+ and OpenSSL 1.1.0+. (In other cases, we use a modified version of 
`ssl.match_hostname` that does not consider common names.)

I would expect that setting `hostname_checks_common_name` to False would 
rejects certificates without SANs, but that does not appear to be the case. I 
used the following Python code:

import socket
import ssl

print(ssl.OPENSSL_VERSION)
hostname = 'localhost'
context = ssl.create_default_context()
context.load_verify_locations("client.pem")
context.hostname_checks_common_name = False

with socket.create_connection((hostname, 8000)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
assert "subjectAltName" not in ssock.getpeercert()


which prints `OpenSSL 1.1.1i  8 Dec 2020` and does not fail as expected. I'm 
testing this on macOS 11.2.2 but this currently breaks our test suite on 
Ubuntu, Windows and macOS, including on Python 3.10, see 
https://github.com/urllib3/urllib3/runs/2122811894?check_suite_focus=true.

To reproduce this, I used trustme (https://trustme.readthedocs.io/en/latest/). 
I modified the code to not include a SAN at all and ran `gunicorn --keyfile 
server.key --certfile server.pem app:app`, with app being the Flask quickstart 
application. I'll try to attach all those files if I manage to do it.

What am I missing?

--
assignee: christian.heimes
components: SSL
files: no_san_ignored.py
messages: 388875
nosy: Quentin.Pradet, christian.heimes
priority: normal
severity: normal
status: open
title: SSLContext.hostname_checks_common_name appears to have no effect
versions: Python 3.10
Added file: https://bugs.python.org/file49879/no_san_ignored.py

___
Python tracker 

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



[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

The reason that we weren't support these cases was there were simply no way 
achieve them by parsing code so we simply ignored (empty sets etc). Though 
considering that you have a decent use case in hy, I'd agree that these small 
additions are viable.

--

___
Python tracker 

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



[issue43477] from x import * behavior inconsistent between module types.

2021-03-16 Thread Brett Cannon


Brett Cannon  added the comment:

Thanks for the clarification! I think I understand what's going on now, and the 
logic is actually expected.

When you do `from .test_submodule import *`, Python must first import 
`test_pkg.test_submodule` in order to get you the object for the `import *` 
part (or frankly anything that comes after `import`). As part of importing 
`test_pkg.test_submodule`, it automatically gets attached to `test_pkg`, 
otherwise we wouldn't be able to cache the module in `sys.modules` and prevent 
redundant/duplicate imports.

As such, when you do `import test_pkg` in`test.py`, the fact that 
`test_pkg.__init__` has to import `test_pkg.test_submodule` means `test_pkg 
will automatically end up with a `test_submodule` attribute. That's why your 
`print()` function call succeeds.

If I'm still misunderstanding, can you please use an `assert` statement that 
fails because the logic doesn't work the way you expect it to be?

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



[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Kodiologist


Change by Kodiologist :


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

___
Python tracker 

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



[issue43521] Allow `ast.unparse` to handle NaNs and empty sets

2021-03-16 Thread Kodiologist


New submission from Kodiologist :

`ast.unparse` throws an error on an empty set, and it produces `nan` for NaN, 
which isn't a legal Python literal.

PR to follow shortly.

--
messages: 388872
nosy: Kodiologist
priority: normal
severity: normal
status: open
title: Allow `ast.unparse` to handle NaNs and empty sets
type: enhancement
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-16 Thread Petr Viktorin


Petr Viktorin  added the comment:

There seems to be much confusion here. Maybe on my side?

PEP 489 is *very much* part of the limited API.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

PyUnicode_WRITE, PyUnicode_READ, and PyUnicode_READ_CHAR all reuse their 
arguments, and there's a lot of occurrences (58 AFAICS) where they are called 
with the increment operator applied to the index argument. For example:

Objects/unicodeobject.c:PyUnicode_WRITE(kind, data, pos++, ch);
Modules/_io/textio.c:   c = PyUnicode_READ(kind, in_str, i++);
Objects/stringlib/unicode_format.h: c = PyUnicode_READ_CHAR(self->str.str, 
self->index++);


Would a single PR for all three of them be acceptable, Victor?

--

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

Related: #6632

--

___
Python tracker 

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



[issue43284] Inability to fetch build 20H2

2021-03-16 Thread Eryk Sun


Eryk Sun  added the comment:

Note that the following recommendation for getting the system version was 
removed in late 2019 [1][2]:

To obtain the full version number for the operating system,
call the GetFileVersionInfo function on one of the system
DLLs, such as Kernel32.dll, then call VerQueryValue to obtain
the \\StringFileInfoProductVersion subblock of the file 
version information.

The first commit added advice to check the "CurrentBuildNumber" registry value 
in Windows 10 1909+, but an engineer decided to just remove the paragraph. 
Apparently the developers do not want to guarantee that the version information 
on any particular system DLL can be used to get the system version. Apparently 
they also do not want to officially sanction using the 
"CurrentMajorVersionNumber", "CurrentMinorVersionNumber", and  
"CurrentBuildNumber" values in the registry.

---

[1] https://github.com/MicrosoftDocs/win32/pull/143
[2] 
https://docs.microsoft.com/en-us/windows/win32/sysinfo/getting-the-system-version

--
nosy: +eryksun

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Mark Dickinson

Mark Dickinson  added the comment:

Seems worth noting that Unicode fractions like ⅔ produce a FRACTION SLASH 
character when normalized:

>>> unicodedata.normalize('NFKC', '⅔')
'2⁄3'
>>> list(map(unicodedata.name, unicodedata.normalize('NFKC', '⅔')))
['DIGIT TWO', 'FRACTION SLASH', 'DIGIT THREE']

--

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Mark Dickinson

Mark Dickinson  added the comment:

There's a bigger issue here about what characters should be accepted in numeric 
literals. The Unicode minus sign (U+2212) "−" is also not currently accepted 
for Fractions or any other built-in numeric type.

> but there are other similar slashes such as (0x2044) in which it throws an 
> error

Do you have a proposal for the set of slashes that should be accepted, or a 
non-arbitrary rule for determining that set?  U+2044 (FRACTION SLASH), U+2215 
(DIVISION SLASH) and U+FF0F (FULLWIDTH SOLIDUS) all seem like potential 
candidates. Are there others?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43520] Fraction only handles regular slashes ("/") and fails with other similar slashes

2021-03-16 Thread Carl Anderson

New submission from Carl Anderson :

Fraction works with a regular slash:

>>> from fractions import Fraction
>>> Fraction("1/2")
Fraction(1, 2)

but there are other similar slashes such as (0x2044) in which it throws an 
error:

>>> Fraction("0⁄2")
Traceback (most recent call last):
  File "", line 1, in 
  File "/opt/anaconda3/lib/python3.7/fractions.py", line 138, in __new__
numerator)
ValueError: Invalid literal for Fraction: '0⁄2'


This seems to come from the (?:/(?P\d+))? section of the regex 
_RATIONAL_FORMAT in fractions.py

--
components: Library (Lib)
messages: 388865
nosy: weightwatchers-carlanderson
priority: normal
severity: normal
status: open
title: Fraction only handles regular slashes ("/") and fails with other similar 
slashes
type: enhancement
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



[issue43519] access python private variable

2021-03-16 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug, it is working as intended.

Python does not really support "private" attributes, except by convention. 
Names that begin with a single leading underscore are no different than any 
other name to the interpreter, but the reader is expected to not touch it.

Double-underscore names are no different, except that they have their names 
mangled so that subclasses can have their own version of the attribute that 
doesn't clash with that of the parent class.

Most people find that the double-underscore attributes are not worth the 
trouble. However you may like to read this:

https://www.python.org/dev/peps/pep-0008/#id49


By the way, attributes and variables in Python don't have fixed memory 
addresses. Whatever you did to make you think that:

"Both are located on a different location in memory."

you have misinterpreted what you are seeing.

There is no language feature to get the memory address of any object or 
variable in Python, except perhaps as an accident of implementation. And some 
interpreters include compacting garbage collectors that can move objects around 
memory.

--
nosy: +steven.daprano
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



[issue41654] Segfault when raising MemoryError

2021-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1f0cde678406749524d11e852a16bf243cef5c5f by Miss Islington (bot) 
in branch '3.9':
bpo-41654: Fix compiler warning in MemoryError_dealloc() (GH-22387) (GH-24894)
https://github.com/python/cpython/commit/1f0cde678406749524d11e852a16bf243cef5c5f


--

___
Python tracker 

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



[issue43519] access python private variable

2021-03-16 Thread David Elmakias


New submission from David Elmakias :

It might be my lack of knowledge in python, however I find this behavior a bit 
strange.

By declaring a private variable in a class, python creates an attribute with 
the name '___'.
Both are located on a different location in memory.

I found that by assigning data to the created variable with the exact 
name/notation '___' I changed the private 
variable data.

--
components: Build
files: access_class_private_variable.py
messages: 388862
nosy: AluminumPirate
priority: normal
severity: normal
status: open
title: access python private variable
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49878/access_class_private_variable.py

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-16 Thread mattip


mattip  added the comment:

I am confused. How can widening the usable number of functions (i.e. using the 
whole C-API rather than the limited API) help c-extension modules be usable in 
subinterpreters? Aren't the same singletons, exception types, and other types 
exposed in the full C-API?

--
nosy: +mattip

___
Python tracker 

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



[issue43512] Bug in isinstance(instance, cls) with cls being a protocol? (PEP 544)

2021-03-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yeah, the runtime isinstance() checking is not required to give the right 
answer. Also, I believe one of the rules is "if you inherit from a protocol you 
are deemed to implement it". For methods, abstract methods can (but needn't) be 
used to indicate mandatory features. For attributes, there is no guarantee.

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-16 Thread Eric Snow


Eric Snow  added the comment:

FYI, I posted to capi-sig about this:

https://mail.python.org/archives/list/capi-...@python.org/thread/INLCGPMTYFLRTWQL7RB4MUQZ37JAFRAU/

--

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +23661
pull_request: https://github.com/python/cpython/pull/24896

___
Python tracker 

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



[issue43518] textwrap.shorten does not always respect word boundaries

2021-03-16 Thread annesylvie


New submission from annesylvie :

The `shorten` function from the `textwrap` module does not always break strings 
at the correct location.

`shorten("hello world!", width=7, placeholder="")`
 returns
`'hello'`
as expected, but
`shorten("hello world!!", width=7, placeholder="")`
returns
`'hello w'`
which is incorrect. The error seems to appear when two or more exclamation 
marks (in this specific example) are added.

--

___
Python tracker 

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



[issue43518] textwrap.shorten does not always respect word boundaries

2021-03-16 Thread annesylvie


Change by annesylvie :


--
components: Library (Lib)
nosy: annesylvie
priority: normal
severity: normal
status: open
title: textwrap.shorten does not always respect word boundaries
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +brett.cannon, eric.snow, nanjekyejoannah, ncoghlan, serhiy.storchaka

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Created a new issue + fix in issue43517.

--
resolution:  -> fixed
stage: needs patch -> 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



[issue43515] Lazy import in concurrent.futures produces partial import errors

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Fix false positives in circular import detection with 
from-imports

___
Python tracker 

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



Re: How do I read .csv files

2021-03-16 Thread The Cool Life
Try importing the CSV module. That might help!


> On Mar 16, 2021, at 6:27 AM, Gys  wrote:
> 
> On 3/12/21 11:28 AM, Johann Klammer wrote:
>> Specifically ones with quoted strings. I'll have whitespace in
>> there and possibly escaped quotechars.
>> maybe newlines too.
>> Which means that pyparsing commaSeparatedList.parseString(line) won't work.
>> I also like to edit them for visual alignment, so there'll
>> be whitespaces outside the strings(more than one)
>> ...therefore, csv.DictReader() won't work.
>> I'd like them read into a dict or something..
> 
> Hi Johann Klammer,
> I use Pandas for handling *.csv files
> 
> pandas documentation :
> 
> 
> 
> Hands on example :
> 
> 
> 
> -hth
> Gys
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41567] multiprocessing.Pool from concurrent threads failure on 3.9.0rc1

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Fix false positives in circular import detection with 
from-imports

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Ammar Askar  added the comment:

Sure thing, I'll work on the backport.

--

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
keywords: +patch
pull_requests: +23660
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24895

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Ammar Askar, do you mind to backport PR 20628 to 3.9? It is the only warning 
left, and it seems there is a potential bug.

--

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-16 Thread Antoine Pitrou


New submission from Antoine Pitrou :

This seems to be caused by a logic error in the patch for issue35943.

It has been causing multiple issues for multi-threaded and multi-process 
systems written in Python:
* issue41567
* issue43515
* https://github.com/dask/distributed/issues/4168

--

___
Python tracker 

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



[issue43516] python on raspberry pi

2021-03-16 Thread Eric V. Smith

Eric V. Smith  added the comment:

You’ve not told us the behavior you see or the behavior you expect, so we can’t 
tell if this is a bug in python. 

But it’s in all likelihood not a bug. If you want to get help with your code, I 
suggest asking on the python-list mailing list or maybe Stackoverflow. This bug 
tracker is not a support forum. 

https://mail.python.org/mailman/listinfo/python-list

--
nosy: +eric.smith
status: open -> pending

___
Python tracker 

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



[issue43481] PyEval_EvalCode() namespace issue not observed in Python 2.7.

2021-03-16 Thread Chris Morton


Chris Morton  added the comment:

Root cause appears to be indexing c with [] operator. Replacing len(c) with 4 
produces the same error.

--

___
Python tracker 

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



[issue43517] Fix false positives in circular import detection with from-imports

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
assignee: pitrou
components: Library (Lib)
nosy: pitrou
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: Fix false positives in circular import detection with from-imports
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue43512] Bug in isinstance(instance, cls) with cls being a protocol? (PEP 544)

2021-03-16 Thread Ken Jin


Ken Jin  added the comment:

Apologies if I misunderstood something, but doesn't PEP 544 also state in its 
"Rationale", "Non-goals" subsection that

"""
At runtime, protocol classes will be simple ABCs. There is no intent to provide 
sophisticated runtime instance and class checks against protocol classes. This 
would be difficult and error-prone and will contradict the logic of PEP 484.
"""

https://www.python.org/dev/peps/pep-0544/#non-goals

Which means that the Python runtime isn't supposed to check that, instead it's 
the static type checker's responsibility?

--
nosy: +gvanrossum, kj, levkivskyi

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
nosy_count: 2.0 -> 3.0
pull_requests: +23659
pull_request: https://github.com/python/cpython/pull/22387

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +23658
pull_request: https://github.com/python/cpython/pull/20508

___
Python tracker 

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



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +ammar2
nosy_count: 1.0 -> 2.0
pull_requests: +23657
pull_request: https://github.com/python/cpython/pull/20628

___
Python tracker 

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



[issue43516] python on raspberry pi

2021-03-16 Thread Yann Enoti


New submission from Yann Enoti :

Any idea why this doesnt work ?


import socket

HOST = "192.168.2.114"
PORT = 8000 #initiate port no above 1024

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('Socket created')

#try:
s.bind((HOST, PORT))  #bind host address and port together#
#except socket.error as e:
#print('Bind failed.')

s.listen(10)  #configure how many clients the server can listen to 
simultaneously

print("Socket is Listening")
 
#conn, addr = s.accept()#accept new connection
#print("connection from:" + str(addr))


while True:
conn, addr = s.accept()#accept new connection
print("connection from:" + str(addr))

data = conn.recv(1024).decode()  #receive data stream

#if not data: #if data is not received break
   # break
print("from Android App:" + str(data))
data = input ('from Python Server:')
conn.send(data.encode())  #send data to client
conn.close()  #close the connection

--
components: Build
messages: 388850
nosy: gyenoti
priority: normal
severity: normal
status: open
title: python on raspberry pi

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

After analysis, it may not need reversal.  There is a simple logic error it 
seems.  Will check.

--

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.10, Python 3.9 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue41654] Segfault when raising MemoryError

2021-03-16 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +23656
pull_request: https://github.com/python/cpython/pull/24894

___
Python tracker 

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



[issue43503] [subinterpreters] PyObject statics exposed in the limited API break isolation.

2021-03-16 Thread Eric Snow


Eric Snow  added the comment:

One simple solution is to explicitly state that the limited API does not 
support subinterpreters.  This is already implied by the fact that the 
multi-phase init API (PEP 489) requires subinterpreter support but is not part 
of the limited API.

If we establish this constraint then the problem I originally described here 
goes away (and we can close this issue).

(Note: I'm pretty sure this is something someone suggested to me at some point, 
rather than my own idea.)

--

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Ok, going through other open issues including on third-party projects, I think 
these changes should unfortunately be reverted.  The regressions produced are 
far from trivial and most developers seem at a loss how to fix them.

--

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Note the conjunction of this change + issue32596 produces import fragility:
https://bugs.python.org/issue43515

--

___
Python tracker 

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



[issue43515] Lazy import in concurrent.futures produces partial import errors

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Bisecting actually points to issue35943.

--

___
Python tracker 

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



[issue43515] Lazy import in concurrent.futures produces partial import errors

2021-03-16 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
versions:  -Python 3.8

___
Python tracker 

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



[issue43515] Lazy import in concurrent.futures produces partial import errors

2021-03-16 Thread Antoine Pitrou


New submission from Antoine Pitrou :

Here is a reproducer script:
https://gist.github.com/pitrou/a73fa2cfce2557e0dd435353b9976972

With Python 3.6 it works fine.

--
components: Library (Lib)
messages: 388844
nosy: methane, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Lazy import in concurrent.futures produces partial import errors
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue32596] Lazy import concurrent.futures.process and thread

2021-03-16 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I don't think this was a good idea. Making some imports implicitly lazy 
introduces unpredictability in stdlib imports. Here is an example bug report:
https://issues.apache.org/jira/browse/ARROW-11983

--
nosy: +pitrou

___
Python tracker 

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



[issue43514] Disallow fork in a subinterpreter affects multiprocessing plugin

2021-03-16 Thread Christian Heimes


Christian Heimes  added the comment:

Could you please post the error message and either post a minimal example or 
give us a link to your code?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue43514] Disallow fork in a subinterpreter affects multiprocessing plugin

2021-03-16 Thread Frank Ueberschar


New submission from Frank Ueberschar :

Related to this issue https://bugs.python.org/issue34651, our Bareos libcloud 
plugin cannot be run with Python > 3.7. We are using subprocesses in a 
C-subinterpreter environment. 

Is there a way to circumvent rewriting our code completely?

--
components: C API
messages: 388841
nosy: franku
priority: normal
severity: normal
status: open
title: Disallow fork in a subinterpreter affects multiprocessing plugin
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue43513] venv: recreate symlinks on --upgrade

2021-03-16 Thread ThiefMaster


New submission from ThiefMaster :

When using `python -m venv --upgrade someenv`, it rewrites `pyvenv.cfg` with 
the current python version but leaves the python symlinks untouched 
(https://github.com/python/cpython/blob/a8ef4572a6b28bcfc0b10b34fa4204954b9dd761/Lib/venv/__init__.py#L248)

This is of course fine when the original location of the Python interpreter is 
something like `/usr/bin/python3.9`, but when using pyenv it's a path 
containing the full version such as 
`/home/USER/.pyenv/versions/3.9.2/bin/python`, which makes in-place updates of 
minor Python versions harder than needed (manual update of the symlink needed).

IfF you agree that this change makes sense, I wouldn't mind sending a PR for 
this...

--
components: Library (Lib)
messages: 388840
nosy: ThiefMaster
priority: normal
severity: normal
status: open
title: venv: recreate symlinks on --upgrade
type: enhancement

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


Added file: https://bugs.python.org/file49877/macros-that-reuse-args.txt

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


Removed file: https://bugs.python.org/file49876/macros-that-reuse-args.txt

___
Python tracker 

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



[issue43502] [C-API] Convert obvious unsafe macros to static inline functions

2021-03-16 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Under Include/, including subdirectories, there are 88 macros that reuse 
arguments.

--
Added file: https://bugs.python.org/file49876/macros-that-reuse-args.txt

___
Python tracker 

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



Re: How do I read .csv files

2021-03-16 Thread Benjamin Schollnick
The best answer is to use the CSV library, but there are wrappers around it.

For example, I use a wrapper of my own creation (csv_common.py) @ 
https://github.com/bschollnick/bas_Utilities 
.
The main benefit is that I can create variant CSV’s by just inheriting and 
redefining portions of it, very quickly.  

But, Panda’s and other tools are just as valid as well.

But I would really recommend playing with the CSV library first, and understand 
how it works, before using a wrapper or a totally different tool.  
Understanding the basics really simplifies the learning process, and gives you 
a foundation to build upon.

- Benjamin

> On Mar 16, 2021, at 8:23 AM, Gys  wrote:
> 
> On 3/12/21 11:28 AM, Johann Klammer wrote:
>> Specifically ones with quoted strings. I'll have whitespace in
>> there and possibly escaped quotechars.
>> maybe newlines too.
>> Which means that pyparsing commaSeparatedList.parseString(line) won't work.
>> I also like to edit them for visual alignment, so there'll
>> be whitespaces outside the strings(more than one)
>> ...therefore, csv.DictReader() won't work.
>> I'd like them read into a dict or something..
> 
> Hi Johann Klammer,
> I use Pandas for handling *.csv files
> 
> pandas documentation :
> 
> 
> 
> Hands on example :
> 
> 
> 
> -hth
> Gys
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >