Segfault if `progress` function passed into `SaneDev.snap()` has one argument

Aperta
#81 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
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, python
Ambito
api

Direzione di ricerca

Start in sane.py and _sane.c, then reproduce SaneDev.snap() with a progress callback accepting one argument and compare it with the documented two-argument form. Trace how the callback is invoked and ensure the one-argument case no longer segfaults; update the documentation if the callback requirements remain unclear.

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

Descrizione

I couldn't find anything in the docs about how to use the progress callback function available in SaneDev.snap(). My first try was to pass in a function with only one argument, and this caused a segmentation fault in the python interpreter. (For anyone looking, you need to pass in a function that accepts two arguments. The first will be the number of lines scanned so far, and the second will be the total number of lines).

I'm not super familiar with CPython but it looks like passing two arguments into a python callable that only accepts one causes a segfault. I couldn't find a way in the docs to check the number of arguments in CPython (that must exist right?) so I don't know how to fix it in _sane.c. However one simple fix within sane.py would be to check the type of the progress object passed in to snap(), and wrap it in a function that accepts two arguments.

Lingua principale
C
Stelle
61
Fork
22
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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 python-pillow/Sane

Tutte le issue di python-pillow/Sane

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.