Proposal: Fix `NTDebugHandler` and Deprecate `setup_logging` in `logutil.py`.
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia da comtypes/logutil.py, in particolare da NTDebugHandler e setup_logging, quindi esamina il loro utilizzo in server/inprocserver.py. Esamina l’issue 671 e la pull request 921 integrata per il contesto. Il lavoro è completato quando l’handler non presenta più l’incompatibilità segnalata con Python 3 e setup_logging è chiaramente deprecato, senza che rimanga alcuna responsabilità di logging non necessaria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The logutil module contains components that are either broken, or overly broad in this project responsibilities, and have not been properly maintained or tested for a long time.
I propose to fix the NTDebugHandler class and deprecate the setup_logging function.
Problems
1. NTDebugHandler is broken due to Python 2/3 str vs bytes incompatibility
- In Python 2,
strrepresented byte sequences, and Unicode strings were handled by a separateunicodetype.
In Python 3,strrepresents Unicode text, andbytesis used explicitly for byte sequences. - In Python 3,
logging.Formatter.format, which is invoked bylogging.Logger.format, always returns a Unicode string (str). - The
NTDebugHandler.emitmethod has a type check (isinstance(text, str)) and passing thisstrdirectly to_OutputDebugStringA(which expectsLPCSTR(bytes)) inevitably leads to errors. - So
_OutputDebugStringW(for wide character strings) is sufficient. The existing type branching is now a source of malfunction.
2. setup_logging has excessive responsibility
- The
setup_loggingis a justloggingutility, unrelated to COM or Windows. - Such
loggingconfiguration responsibilities should ideally rest with the application developer.
3. Lack of usage and redundancy
- These components are likely unused or used in very limited circumstances for a long time.
NTDebugHandleris used inserver/inprocserver.py, but as discussed in https://github.com/enthought/comtypes/issues/671, the use case forinprocserverhas not been confirmed for years.
This suggests either that its breakage has gone unnoticed, or developers are using forks/custom patches.- The
setup_loggingfunction is not called anywhere withinserver/inprocserver.py, indicating its non-essential nature for the project and a weak justification for its existence.
Proposal
For the reasons outlined above, we propose to fix NTDebugHandler and deprecate the setup_logging function from this library.
This will simplify the codebase, resolve potential Python version incompatibility issues, and clarify the scope of this project responsibilities.
I plan to fix NTDebugHandler by the next release and deprecate setup_logging, with a view to removing it in a future version (likely 1.5.0).
- Lingua principale
- Python
- Stelle
- 346
- Fork
- 107
- Merge medio
- 22h 5m
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di enthought/comtypes
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
typing
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
automation.VARIANT._set_value assumes c_char.value has length 1Forse già presa @haoxuanjng-lang l’ha presa 4 giorni fa. Apertaquestion
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
enthought/comtypes#935 · 10 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[CI] Run tests on ARMApertaci tests
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
enthought/comtypes#925 · 11 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
enthought/comtypes#873 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di enthought/comtypes
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws-samples/sample-per-model-bedrock#191 ·
I maintainer di solito rispondono entro 1 giorno
-
Docs viewer: inverted grey colormap, Phantom CT window -20 to 35 HU, smoothing up to 40 mmForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: docs enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
PyTomography/PyTomography#331 ·
I maintainer di solito rispondono entro 1 giorno
-
effort: low prio: low ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
digitalfabrik/integreat-cms#4616 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
FuRongJun-1999/dsh-memory#226 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty:2 good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
MakazhanAlpamys/Soup#1865 ·
I maintainer di solito rispondono entro 1 giorno