[New-bugs-announce] [issue45987] os.chdir in unittest's test case causes RecursionError on Windows

Toshihiro Kamiya report at bugs.python.org
Sun Dec 5 09:25:09 EST 2021


New submission from Toshihiro Kamiya <kamiya at mbj.nifty.com>:

When I was writing unit tests, I noticed that os.chdir in the unittest test case failed with RecursionError.

It seems to work fine on Ubuntu 20.04, but fails on Windows 10 (might fail on macOS).

The attached file is a minimal code to reproduce this.

When I run it, I got an error message as follows

```
PS C:\Users\toshihiro\tmp> python .\test_chdir_fails.py
Traceback (most recent call last):
  File "C:\Users\toshihiro\tmp\test_chdir_fails.py", line 11, in <module>
    unittest.main()
  File "C:\Users\toshihiro\AppData\Local\Programs\Python\Python39\lib\unittest\main.py", line 101, in __init__
    self.runTests()
(snip)
  File "C:\Users\toshihiro\AppData\Local\Programs\Python\Python39\lib\traceback.py", line 493, in __init__
    context = TracebackException(
  [Previous line repeated 487 more times]
RecursionError: maximum recursion depth exceeded
PS C:\Users\toshihiro\tmp>
```

The version of python was:
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

Regards,

----------
components: Library (Lib)
files: test_chdir_fails.py
messages: 407711
nosy: tos-kamiya
priority: normal
severity: normal
status: open
title: os.chdir in unittest's test case causes RecursionError on Windows
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file50476/test_chdir_fails.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45987>
_______________________________________


More information about the New-bugs-announce mailing list