[issue38149] sys.audit() is called multiple times for glob.glob()

2020-02-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue38149] sys.audit() is called multiple times for glob.glob()

2020-02-06 Thread miss-islington
miss-islington added the comment: New changeset 708f472dd92f4f46c27ace710492da65da4a3319 by Miss Islington (bot) in branch '3.8': bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360) https://github.com/python/cpython/commit/708f472dd92f4f46c27ace710492da65da4a3319

[issue38149] sys.audit() is called multiple times for glob.glob()

2020-02-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +17749 pull_request: https://github.com/python/cpython/pull/18373 ___ Python tracker ___ __

[issue38149] sys.audit() is called multiple times for glob.glob()

2020-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 54b4f14712b9350f11c983f1c8ac47a3716958a7 by Serhiy Storchaka in branch 'master': bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360) https://github.com/python/cpython/commit/54b4f14712b9350f11c983f1c8ac47a3716958a7 ---

[issue38149] sys.audit() is called multiple times for glob.glob()

2020-02-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +17735 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18360 ___ Python tracker ___

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is harder to avoid repeating calls in os.walk(), because it is recursive itself. But you can introduce a recursive helper _walk() and make os.walk() just calling sys.audit() and _walk(). -- ___ Python tracker

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it would be better to call sys.audit() in glob.iglob(), before calling the top-level _iglob(). It will give you a general context, and at every recursion level sys.audit() will be called for os.scandir(). -- ___

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Steve Dower
Steve Dower added the comment: > when added sys.audit() for glob.glob(), should not it be added for > Path.glob() too? And for os.walk()? Sure, those would make sense. They all go via scandir() which has its own event too (and will do for each directory), but being able to see that it came

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ah, and when added sys.audit() for glob.glob(), should not it be added for Path.glob() too? And for os.walk()? -- ___ Python tracker ___ _

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using recursion is rather an implementation detail, because splitpath() splits a path from the end (Path.glob() does it from other side). Also, it may be a tiny bit more efficient if the pattern contains a long literal prefix. -- _

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Steve Dower
Steve Dower added the comment: Provided it's called with different arguments each time (which it is), there isn't a problem here. Audit hooks are supposed to be informative, not definitive (that is, you almost always need to take the surrounding context into consideration, which is why they

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Steve Dower
Change by Steve Dower : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue38149] sys.audit() is called multiple times for glob.glob()

2019-09-13 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : sys.audit() for "glob.glob" is called in a recursive function _iglob(). So in process of executing glob.glob() it can be called multiple times, with the original pattern and with patterns for parent directories, while there are metacharacters in them. I