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

Parameter values shared across Python class instances

Aperta
#313 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
cpp, python
Ambito
tooling

Direzione di ricerca

Start by locating the Python code generator and its tests for generated parameter classes; the issue does not name specific files. Check how the generated Param class declares parameter values and how instances are tested. Done means each new instance starts with independent parameter values, with a test covering that behavior.

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

Descrizione

I’m trying to create tests to verify the interaction of my software with the generate_parameter_library. I want to save the parameters to a file when they are updated in both Python and C++. The testes for the C++ version worked correctly, but in Python, I noticed an odd behaviour. The parameter values are shared across multiple instances. This resulted in the tests failing due to an inconsistent initial value. I expected a reset to parameter values when a new instance is created.

Looking at the generated code, I noticed the Param class doesn’t have an __init__(self) function and declares the parameters directly in the class body. This causes the parameters to be shared between instances. Is this the desired behaviour?

Adding the __init__(self) function and selfto the variables solved this. As a quick fix, I reloaded the entire module between each test.

If this is not intended, I can provide a pull request to solve this issue.

Auto generated code:
Image

Expected generated code:

Image
Lingua principale
Python
Stelle
385
Fork
81
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

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 PickNikRobotics/generate_parameter_library

Tutte le issue di PickNikRobotics/generate_parameter_library

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.