Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

InStream.get_channels_buffer_size uses wrong encoding

Aperta
#620 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, backend

Direzione di ricerca

Inizia in generated/nidaqmx/task/_in_stream.py, in InStream.get_channels_buffer_size, e in generated/nidaqmx/task/_out_stream.py, in OutStream.get_channels_buffer_size. Leggi come viene decodificato Task.channel_names, quindi esamina la chiamata DAQmxGetTaskChannels e il relativo comportamento di codifica nativa. Il lavoro è completato quando le proprietà delle condizioni di errore ricevono una dimensione del buffer basata sulla rappresentazione dell’API C e non producono più un errore buffer-too-small per i nomi dei canali multibyte.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

InStream.get_channels_buffer_size and OutStream.get_channels_buffer_size read the Task.channel_names property to calculate the maximum buffer size for a fault condition status property such as overcurrent_chans.

The problem is that these functions are calculating the length of the channel_names property after decoding from bytes to str. If Python represents str as UTF-16 or UTF-32, the number of characters in a str may be smaller than the number of UTF-8 bytes used to return that str from the DAQmx C API. When this happens, reading the fault condition property will likely return a "buffer too small" error when there is a fault.

Some potential solutions:

  • Use DAQmxGetTaskChannels(task, NULL, 0) to query the size of the TaskChannels property in the C API's native encoding (UTF-8 or MBCS). This would also be a small optimization because it would query the size of the TaskChannels property without querying the actual value.
  • Convert the task channels back to the C API's native encoding. This is a hack, so the first solution is better.
Lingua principale
Python
Stelle
592
Fork
199
Merge medio
1g 16h
PR unite (30g)
10

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ni/nidaqmx-python

Tutte le issue di ni/nidaqmx-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.