[issue41560] pathlib.Path.glob fails on empty string

2020-08-15 Thread Alexander Heger


New submission from Alexander Heger :

Passing an empty string to pathlib.Path.glob fails.

Example
```
from pathlib import Path
path = Path('./myfile.txt')
path.glob('')
```

The result is:
```
~/Python/lib/python3.8/pathlib.py in glob(self, pattern)
   1129 """
   1130 if not pattern:
-> 1131 raise ValueError("Unacceptable pattern: 
{!r}".format(pattern))
   1132 drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
   1133 if drv or root:

ValueError: Unacceptable pattern: ''
```

This is not the desired or expected behaviour, which would be to just return 
`path` if it exists.  This behaviour is also inconsistent with the 
documentation which states (Python 3.8.5):
"""
Glob the given relative pattern in the directory represented by this path, 
yielding all matching files (of any kind):
"""

And it is in contrast to the behaviour of glob.glob, which is just fine with 
the empty string, returning an empty list.

--
components: Library (Lib)
messages: 375499
nosy: alex.heger
priority: normal
severity: normal
status: open
title: pathlib.Path.glob fails on empty string
type: crash
versions: Python 3.8

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



[issue41560] pathlib.Path.glob fails on empty string

2020-08-17 Thread Alexander Heger


Alexander Heger  added the comment:

In my code, having been translated form use of `os.path` to `pathlib.Path` the 
change in behaviour caused errors and required significant refactoring.  

Why not just return the empty list if there is no match, as is done in other 
cases when there is no match, except when passing the empty string.  For 
example, in my case, the base path already refers to a potentially existing 
file[name] and I then "glob" for appendices to the filename or suffices (or 
neither or both).  So in this case the glob for empty strong would just return 
the file if it exists.

--

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



[issue25150] yt package pip compile/install error

2015-09-17 Thread Alexander Heger

New submission from Alexander Heger:

trying to install the yt package, most recent version 3.2.1 on python 3.5.0 
using pip

pip3 install -U yt

error output attached.  The same package installs fine with python 3.4.3, same 
compiler and also build from scratch, so the suspicion is that it is related to 
the new 3.5.0 version.  The system installed is the current Fedora 22, gcc 
5.1.1-4.

--
components: Extension Modules
files: error.txt
hgrepos: 318
messages: 250884
nosy: axh
priority: normal
severity: normal
status: open
title: yt package pip compile/install error
type: compile error
versions: Python 3.5
Added file: http://bugs.python.org/file40491/error.txt

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-17 Thread Alexander Heger

Alexander Heger added the comment:

When I just comment out the 

#include "pyatomic.h" 

line, python 3.5.0 will no longer compile

gcc -pthread -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG 
-g -fwrapv -O3 -Wall -Wstrict-prototypes-Werror=declaration-after-statement 
  -I. -IInclude -I./Include-DPy_BUILD_CORE -o Programs/python.o 
./Programs/python.c
In file included from Include/traceback.h:8:0,
 from Include/Python.h:97,
 from ./Programs/python.c:3:
Include/pystate.h:186:8: error: unknown type name ‘_Py_atomic_address’
 PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
^
Makefile:747: recipe for target 'Programs/python.o' failed
make: *** [Programs/python.o] Error 1

pystate.h:

/* Assuming the current thread holds the GIL, this is the
   PyThreadState for the current thread.

   Issue #23644: pyatomic.h is incompatible with C++ (yet). Disable
   PyThreadState_GET() optimization: declare it as an alias to
   PyThreadState_Get(), as done for limited API. */
#if !defined(Py_LIMITED_API) && !defined(__cplusplus)
PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
#endif

--

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-17 Thread Alexander Heger

Alexander Heger added the comment:

if I just include this patch, some modules don't build:

(...)

gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -Wunreachable-code 
-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes 
-Werror=declaration-after-statement 
-Ibuild/temp.linux-x86_64-3.5/libffi/include 
-Ibuild/temp.linux-x86_64-3.5/libffi 
-I/home/alex/Python-3.5.0/Modules/_ctypes/libffi/src -I./Include 
-I/home/alex/Python/include -I. -IInclude -I/usr/local/include 
-I/home/alex/Python-3.5.0/Include -I/home/alex/Python-3.5.0 -c 
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c -o 
build/temp.linux-x86_64-3.5/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.o 
-Wall -fexceptions
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c: In function 
‘PyCSimpleType_from_param’:
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2062:15: error: 
‘_PyThreadState_Current’ undeclared (first use in this function)
 if (Py_EnterRecursiveCall("while processing _as_parameter_")) {
   ^
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2062:15: note: each 
undeclared identifier is reported only once for each function it appears in
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2062:28: error: 
‘__atomic_load_ptr’ undeclared (first use in this function)
 if (Py_EnterRecursiveCall("while processing _as_parameter_")) {
^
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2062:66: error: argument 1 of 
‘__atomic_load’ must be a non-void pointer type
 if (Py_EnterRecursiveCall("while processing _as_parameter_")) {
  ^
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2062:19: warning: cast to 
pointer from integer of different size [-Wint-to-pointer-cast]
 if (Py_EnterRecursiveCall("while processing _as_parameter_")) {
   ^
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2067:62: error: argument 1 of 
‘__atomic_load’ must be a non-void pointer type
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2067:21: warning: cast to 
pointer from integer of different size [-Wint-to-pointer-cast]
 Py_LeaveRecursiveCall();
 ^
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2067:62: error: argument 1 of 
‘__atomic_load’ must be a non-void pointer type
/home/alex/Python-3.5.0/Modules/_ctypes/_ctypes.c:2067:139: warning: cast to 
pointer from integer of different size [-Wint-to-pointer-cast]

Failed to build these modules:
_ctypes   _decimal  _json  
_pickle

--

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-17 Thread Alexander Heger

Alexander Heger added the comment:

So, apparently, more than just one spot needs to be fixed.  I also tried just 
modifying the Python.h after install, but that does not do the trick either.

--

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-09-20 Thread Alexander Heger

Alexander Heger added the comment:

Dear Victor,

yes, you patch seems to fix the yt install.  Thank you very much!

I hope this can be included in 3.5.1.

Best wishes,
Alexander

--

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



[issue25150] 3.5: Include/pyatomic.h is incompatible with OpenMP (compilation of the third-party yt module fails on Python 3.5)

2015-11-23 Thread Alexander Heger

Alexander Heger added the comment:

seems to work now with 3.5.1rc1

On 5 November 2015 at 23:01, STINNER Victor  wrote:
>
> STINNER Victor added the comment:
>
> "Pyatomic-2.patch solved the problem."
>
> Great! The good news is that the Python 3.5.1 release has now a schedule: 
> https://www.python.org/dev/peps/pep-0478/
>
> "3.5.1 final: December 6, 2015"
>
> --
>
> ___
> Python tracker 
> <http://bugs.python.org/issue25150>
> ___

--

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