Commit Graph

77 Commits

Author SHA1 Message Date
Victor Stinner 64ff1e217d
gh-119770: Make termios ioctl() constants positive (#119840) 2024-05-31 17:18:40 +02:00
Serhiy Storchaka b313cc68d5
gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected (GH-117631) 2024-05-28 12:01:37 +03:00
Brett Simmers c2627d6eea
gh-116322: Add Py_mod_gil module slot (#116882)
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.

PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.

A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
2024-05-03 11:30:55 -04:00
Victor Stinner 1cf0301086
gh-85283: Build termios extension with the limited C API (#116928) 2024-03-17 15:12:29 +00:00
Soumendra Ganguly bf75f1b147
gh-85984: Add _POSIX_VDISABLE from unistd.h to termios module. (#114985)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-02-11 10:29:44 +00:00
Serhiy Storchaka d22c066b80
gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)
On Alpine Linux it could leave some field non-initialized.
2024-01-23 23:27:04 +02:00
Ronald Oussoren f26bfe4b25
gh-51944: fix type and missing addition in gh-112823 (#112996)
Fix the defition of VDSUSP and add CCTS_OFLOW (which
was mentioned in NEWS, but not actually addded)
2023-12-12 13:57:45 +01:00
Ronald Oussoren 4b125dd31a
gh-51944: Add missing macOS constants to termios (#112823)
* gh-51944: Add some macOS constants to termios

This changeset adds all public constants in <termio.h>
and <sys/termios.h> on macOS that weren't present
already.

Based on the macOS 14.2 SDK

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 11:27:30 +01:00
Nikita Sobolev 2bbbab212f
gh-110365: Fix error overwrite in `termios.tcsetattr` (#110366)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-05 11:02:52 +00:00
Nikita Sobolev 43baddc2b9
gh-110260: Check for PyList_SetItem() errors in termios module (GH-110261) 2023-10-04 15:42:17 +03:00
Jakub Kulík ecc61a6d76
gh-108765: include <unistd.h> in termios.c on Solaris (#108825) 2023-09-02 18:57:47 +00:00
Victor Stinner 1f3e797dc0
gh-108765: Remove old prototypes from pyport.h (#108782)
Move prototypes of gethostname(), _getpty() and struct termios from
pyport.h to the C code using them: posixmodule.c, socketmodule.c and
termios.c.

Replace "#ifdef SOLARIS" with "#ifdef __sun".
2023-09-02 15:46:43 +02:00
Victor Stinner 6353c21b78
gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)
Move the private _PyLong converter functions to the internal C API

* _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h
* _PyLong_Size_t_Converter(): moved to pycore_long.h

Argument Clinic now emits includes for pycore_fileutils.h and
pycore_long.h when these functions are used.
2023-08-26 03:18:09 +02:00
Serhiy Storchaka 329e4a1a3f
gh-86493: Modernize modules initialization code (GH-106858)
Use PyModule_Add() or PyModule_AddObjectRef() instead of soft deprecated
PyModule_AddObject().
2023-07-25 14:34:49 +03:00
Hugo van Kemenade d513ddee94
Trim trailing whitespace and test on CI (#104275)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-08 17:03:52 +03:00
Eric Snow a9c6e0618f
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules.  We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
2023-05-05 21:11:27 +00:00
Ronald Oussoren 959ba45d75
GH-97001: Release GIL in termios extension (#99503)
Without releasing the GIL calls to termios APIs might block the entire interpreter.
2022-11-22 11:14:23 +01:00
Serhiy Storchaka a5a56154f1
Remove trailing spaces. (GH-28706) 2021-10-03 16:58:14 +03:00
Soumendra Ganguly ae224bb566
bpo-41818: Add termios.tcgetwinsize(), termios.tcsetwinsize(). (GH-23686)
* Add termios.tcgetwinsize(), termios.tcsetwinsize(). Update docs.
* Add TIOCGSIZE support to termios.tcgetwinsize()
* Add TIOCSSIZE support to termios.tcsetwinsize()

Authored-by: Soumendra Ganguly <soumendraganguly@gmail.com>

* termios.tcgetwinsize() and termios.tcsetwinsize() should return/accept two-item tuples instead of lists.
* Refactor tcsetwinsize to share common code and accept any two item sequence, with overflow checking.

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2021-08-26 19:56:26 -07:00
Serhiy Storchaka 058fb35b57
bpo-44854: Remove trailing whitespaces (GH-27689) 2021-08-09 21:32:54 +03:00
Serhiy Storchaka 1bcaa81e52
bpo-20184: Convert termios to Argument Clinic. (GH-22693) 2020-10-18 17:54:06 +03:00
Serhiy Storchaka 9975cc5008
bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for "fildes". (GH-22620) 2020-10-09 23:00:45 +03:00
Mohamed Koubaa 15dcdb2113
bpo-1635741: Port the termios to multi-phase init (PEP 489) (GH-22139) 2020-09-08 10:59:15 +02:00
Soumendra Ganguly 97003466d4
Update the comment of termios.c (#21886) 2020-08-17 00:51:00 +09:00
Hai Shi f707d94af6
bpo-39968: Convert extension modules' macros of get_module_state() to inline functions (GH-19017) 2020-03-16 14:15:01 +01:00
Anthony Shaw 7dc72b8d4f bpo-28367: Add additional baud rates for termios (GH-13142)
Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-01-04 13:56:31 +01:00
Dino Viehland bd0c7a12d9 bpo-38071: Make termios PEP-384 compatible (GH-15785)
Make the termios module PEP-384 compatible.
2019-09-10 03:33:30 -07:00
Min ho Kim 39d87b5471 Fix typos mostly in comments, docs and test names (GH-15209) 2019-08-30 16:21:19 -04:00
Zackery Spytz 53835e92d3 Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) 2018-10-29 06:55:20 +02:00
jcea f0a95f27c0
bpo-32660: Solaris should support constants like termios' FIONREAD (#5328) 2018-01-28 14:00:48 +01:00
Serhiy Storchaka 228b12edcc Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible.  Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Jesus Cea 736e7fc0f6 Issue #11495: OSF support is eliminated. It was deprecated in Python 3.2 2011-03-14 17:36:54 +01:00
Antoine Pitrou a78f74ce02 Issue #8078: Add constants for higher baud rates in the termios module.
Patch by Rodolpho Eckhardt.
2010-11-20 20:03:08 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Gregory P. Smith cafc22f0b8 Merged revisions 75999 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75999 | gregory.p.smith | 2009-10-31 14:23:39 -0700 (Sat, 31 Oct 2009) | 2 lines

  Define TCSASOFT if the flag exists.
........
2009-11-01 19:24:18 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Christian Heimes 72b710a596 Renamed PyString to PyBytes 2008-05-26 13:28:38 +00:00
Christian Heimes 217cfd1c86 Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h 2007-12-02 14:31:20 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Martin v. Löwis be4fea6198 Patch #787189: Explicitly define CTRL on SGI. 2003-10-31 13:01:24 +00:00
Neal Norwitz 8225103d2d Get test_ioctl to pass on HPUX 11.
TIOCGPGRP and many other definitions come from bsdtty.h, so it needs
to be included at least on HPUX.
2003-05-23 14:35:24 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Andrew MacIntyre 7bf6833e17 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c
2002-03-03 02:59:16 +00:00
Fred Drake 78f6c867ae Use PyModule_AddObject() instead of accessing the module dict directly. 2002-02-14 07:11:23 +00:00
Martin v. Löwis cdc4451222 Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
Thomas Wouters 2b30524ea9 Forward-port revision 2.24.2.4 from the release21-maint branch:
Protect several more uses of constants with #ifdefs; these are necessary on
(at least) SCO OpenServer 5. Fixes a non-SF-submitted bugreport by Michael
Kent.
2001-06-15 12:05:44 +00:00
Thomas Wouters 819bb2c502 Protect the use of the VWERASE symbol by an #ifdef, it's apparently missing
on (some versions of ?) AIX.
2001-06-11 15:25:16 +00:00
Fred Drake d0b625d05a Correct the sense of a couple of conditional compilations -- used #ifndef
when #ifdef was needed.

This closes (reallu!) SF bug #417418.
2001-05-22 15:44:15 +00:00
Fred Drake 87068f1eaa Include sys/modem.h if we have it; this is needed on HP-UX to provide
constants used by other macros from the headers.

Conditionalize VREPRINT and VDISCARD; these are not available on HP-UX.

This closes bug #417418.
2001-05-11 16:14:17 +00:00