[issue34319] Clarify pathlib.Path("filepath").read_text()

2018-08-03 Thread Thomas Nyberg


Thomas Nyberg  added the comment:

For what it's worth as the original opener of the bug report, I think Terry's 
recommendation clarifies things quite well.

--

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



[issue34319] Clarify pathlib.Path("filepath").read_text()

2018-08-02 Thread Thomas Nyberg


New submission from Thomas Nyberg :

This came out of the following posts:

https://mail.python.org/pipermail/python-ideas/2018-August/052549.html
https://mail.python.org/pipermail/python-ideas/2018-August/052553.html

Basically my request would be to change the documentation here:

https://docs.python.org/3.7/library/pathlib.html#pathlib.Path.read_text

I would like to add a note that the underlying file object itself is closed 
after the read_text() method is called. Maybe I'm just a little dense and it 
should be obvious that the functionality here would be different than 
open("filepath").read(), but given that thread I linked, I don't believe I'm 
the only one.

--
assignee: docs@python
components: Documentation
messages: 322947
nosy: docs@python, thomas.nyberg
priority: normal
severity: normal
status: open
title: Clarify pathlib.Path("filepath").read_text()

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



[issue32980] Remove functions that do nothing in _Py_InitializeCore()

2018-03-03 Thread Thomas Nyberg

Thomas Nyberg <tomnyb...@gmail.com> added the comment:

ince I originated this issue and I think I understand the concerns, I figured I 
could speed up the back and forth in this thread by opening this new PR which 
removes the `_PyFrame_Init()` function. I couldn't find any `_PyFrame_Fini()` 
function in the source so maybe you two are confused and there wasn't a 
corresponding Fini function? (I presume the more likely scenario is that I am 
the one who is confused so feel free to correct that confusion in that case. :) 
)

--

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



[issue32980] Remove functions that do nothing in _Py_InitializeCore()

2018-03-03 Thread Thomas Nyberg

Change by Thomas Nyberg <tomnyb...@gmail.com>:


--
pull_requests: +5732

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



[issue32980] Remove functions that do nothing in _Py_InitializeCore()

2018-03-01 Thread Thomas Nyberg

Change by Thomas Nyberg <tomnyb...@gmail.com>:


--
keywords: +patch
pull_requests: +5719
stage:  -> patch review

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



[issue32980] Remove functions that do nothing in _Py_InitializeCore()

2018-03-01 Thread Thomas Nyberg

New submission from Thomas Nyberg <tomnyb...@gmail.com>:

The `_PyFrame_Init()` and `PyByteArray_Init()` functions are called in these 
two locations in the `_Py_InitializeCore()` function:


https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L693-L694

https://github.com/python/cpython/blob/master/Python/pylifecycle.c#L699-L700

But their function definitions appear to do nothing:


https://github.com/python/cpython/blob/master/Objects/frameobject.c#L555-L561

https://github.com/python/cpython/blob/master/Objects/bytearrayobject.c#L24-L28

I can understand leaving the functions in the source for 
backwards-compatibility, but why are they still being called in 
`_Py_InitializeCore()`? Seems like it just adds noise for those new to the 
cpython internals (I certainly found it confusing myself).

Ned Batchelder recommended possibly making a change:

https://mail.python.org/pipermail/python-list/2018-March/731402.html

--
messages: 313100
nosy: thomas.nyberg
priority: normal
severity: normal
status: open
title: Remove functions that do nothing in _Py_InitializeCore()
type: enhancement

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-13 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Hi Vinay,

You should probably upload a patch with the changes you made (however trivial) 
if you want that version considered. Makes it easier to comment and can then 
point to it for others to consider.

Cheers,
Thomas

--

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-12 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Hi Vinay,

I just checked and yes that code works fine on my end (debian 8 box). 
Personally, I think either this or Mark's second patch would be fine.

Cheers,
Thomas

--

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-12 Thread Thomas Nyberg

Changes by Thomas Nyberg <tomnyb...@gmail.com>:


Removed file: http://bugs.python.org/file46250/venv_site_packages.patch

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-11 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Hi Mark Haase,

I've gone through both of your patches and they both work for me as they 
should. I'm not sure why the first one isn't working for you, since it works 
for me. That one seems like it's solving the problem the "right" way. In any 
case, the second patch works for me as well so if that works for you, then at 
least we can confirm that it works for both your version of OSX and debian 8 
which I'm running.

To any other higher powers: is Mark's second patch acceptable?

--

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-10 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Now that I look over this thread again, I realize that my patch ended up 
basically evolving to being extremely similar to Mark Haase's. The only thing 
that I don't understand though is that he says that his shebangs are somehow 
messed up. For me the shebangs are all fine with my patch. Possibly this is 
difference between his system (OSX) and mine (debian 8)? In any case, I'm 
afraid I may have re-engineered almost the same solution as him (and therefore 
that it doesn't work right), but I guess I needed to go through the process to 
familiarize myself with the problem.

Mark if you're still listening to this thread, maybe you could test this out 
and see if you're still having the same shebang problems? I can't reproduce 
your issue.

--

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-10 Thread Thomas Nyberg

Thomas Nyberg added the comment:

I'm attaching a small patch (against the current hg master branch) that I 
believe solves the problem, however, I think it was quite hacky.

Here is a walk-through of the logic.

1) If '--system-site-packages' is requested, then it is overrided initially in 
the process when creating the config file. I.e. it is hard-coded to 'false' in 
the pyvenv.cfg file.
2) Next ensurepip is run. This is being run in the same state as it would be if 
no '--system-site-packages' flag were passed, so this time it installs some 
packages to the venv's site-packages.
3) If necessary, the config file is regenerated without over-riding the 
system-site-packages flag.
4) If necessary, all packages installed in site-packages are removed and a new 
empty site-packages folder is regenerated.

The logic here is pretty horrid, but it seems to be functioning correctly. 
There are a couple possible issues here:

1) I assume that on all platforms the site-packages folder will always end up 
empty when the no '--system-site-packages' flag is passed.
2) I also assume that on all platforms there are no differences in the venv 
that is produced with or without this option except for the packages installed 
in the system-site-packages folder.

I don't really have any way to verify either of those assumption experimentally 
and I'm not familiar enough with ensurepip/pip to know that way either. I've 
only tested this on my debian system so it could very well not be portable.

Regardless of my misgivings of the quality of this patch, I think a solution to 
this problem is totally essential. The '--system-site-packages' flag is a great 
way to let your distro's package manager install most packages you need while 
allowing you then to install whatever others your distro does not provide. I 
use this all the time to simplify/decrease maintenance complexity. Without this 
fix, the --system-site-packages flag is essentially equivalent to a read-only 
environment and in that case, there's no point in using it at all.

--
nosy: +thomas.nyberg
versions: +Python 3.7 -Python 3.4, Python 3.5
Added file: http://bugs.python.org/file46250/venv_site_packages.patch

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



[issue23076] list(pathlib.Path().glob("")) fails with IndexError

2016-01-23 Thread Thomas Nyberg

Thomas Nyberg added the comment:

I added a patch which causes glob to raise a ValueError exception if it is 
called with an empty string. I also added a test verifying the change and have 
run all the tests and they pass.

Though I've been reading the developer guide, I'm a bit unfamiliar with the 
process here so I'm not totally sure I'm doing this right. I created the patch 
relative to the current default branch (even though the discussion here seems 
to indicate it should maybe be applied going back a few versions).

--
hgrepos: +331
keywords: +patch
nosy: +thomas.nyberg
Added file: http://bugs.python.org/file41703/pathlib_glob.patch

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