Skip to content

Commit bc7fba0

Browse files
authored
[os] Add 3.14 os module deprecations (#15179)
1 parent ab12280 commit bc7fba0

File tree

1 file changed

+53
-12
lines changed

1 file changed

+53
-12
lines changed

stdlib/os/__init__.pyi

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,19 +1395,48 @@ class _wrap_close:
13951395
def write(self, s: str, /) -> int: ...
13961396
def writelines(self, lines: Iterable[str], /) -> None: ...
13971397

1398-
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1399-
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1400-
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
1398+
if sys.version_info >= (3, 14):
1399+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1400+
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1401+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1402+
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1403+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1404+
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
1405+
1406+
else:
1407+
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1408+
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1409+
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
14011410

14021411
if sys.platform != "win32":
1403-
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1404-
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1412+
if sys.version_info >= (3, 14):
1413+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1414+
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1415+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1416+
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1417+
1418+
else:
1419+
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1420+
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1421+
1422+
else:
1423+
if sys.version_info >= (3, 14):
1424+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1425+
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1426+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1427+
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1428+
1429+
else:
1430+
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1431+
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1432+
1433+
if sys.version_info >= (3, 14):
1434+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1435+
def system(command: StrOrBytesPath) -> int: ...
14051436

14061437
else:
1407-
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1408-
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1438+
def system(command: StrOrBytesPath) -> int: ...
14091439

1410-
def system(command: StrOrBytesPath) -> int: ...
14111440
@final
14121441
class times_result(structseq[float], tuple[float, float, float, float, float]):
14131442
if sys.version_info >= (3, 10):
@@ -1440,10 +1469,22 @@ if sys.platform == "win32":
14401469
def startfile(filepath: StrOrBytesPath, operation: str = ...) -> None: ...
14411470

14421471
else:
1443-
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1444-
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1445-
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1446-
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1472+
if sys.version_info >= (3, 14):
1473+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1474+
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1475+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1476+
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1477+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1478+
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1479+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1480+
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1481+
1482+
else:
1483+
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1484+
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1485+
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1486+
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1487+
14471488
def wait() -> tuple[int, int]: ... # Unix only
14481489
# Added to MacOS in 3.13
14491490
if sys.platform != "darwin" or sys.version_info >= (3, 13):

0 commit comments

Comments
 (0)