deepmodeling / deepmodeling/tbplas

[Code scan] Make set_vacancies(None) safely clear vacancies

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
19
Forks
6
PR merge metrics
No merged PRs in 30d

Description

This issue comes from a Codex global scan of deepmodeling/tbplas at commit 4d3652b3dba8eb930e4869a6d41074f62d703692.

Severity: High

`set_vacancies()` has a default `vacancies=None`, which suggests it can be called to clear the vacancy set. The implementation clears `_vacancy_set` and then calls `add_vacancies(None)`, which tries to iterate `None` and raises `TypeError`. There is a second state-safety issue: invalid non-None input also clears the existing vacancies before validation fails.

Code reference:
https://github.com/deepmodeling/tbplas/blob/4d3652b3dba8eb930e4869a6d41074f62d703692/tbplas/builder/super.py#L268-L282

Suggested fix: handle `None` as an empty set explicitly, and validate new vacancies before replacing the existing `_vacancy_set`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.