[New-bugs-announce] [issue9246] os.getcwd() hardcodes max path len

Antoine Pitrou report at bugs.python.org
Tue Jul 13 14:10:59 CEST 2010

New submission from Antoine Pitrou <pitrou at free.fr>:

In 2.x, os.getcwd() uses a dynamic allocation scheme to accomodate whatever buffer size the current path needs to be represented.

In 3.x, the max path length is hardcoded to 1026 bytes or characters, and an error is raised if the current path length is larger than that. Even on systems where MAX_PATH is 1024 (a common value), it is still valid to create paths larger than that (using e.g. os.mkdir()).

The attached script shows that os.getcwd() works with a 1032-character path in 2.x, but fails in 3.x.

components: Extension Modules
files: bigpath.py
messages: 110177
nosy: haypo, loewis, pitrou, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: os.getcwd() hardcodes max path len
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17983/bigpath.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list