Skip to content

[python-package] Remove dead Python 2 guard and sklearn.cross_validation fallback - #12163

Merged
chyunsu3 merged 8 commits into
dmlc:masterfrom
chyunsu3:fix/remove-dead-compat-code
Apr 14, 2026
Merged

[python-package] Remove dead Python 2 guard and sklearn.cross_validation fallback#12163
chyunsu3 merged 8 commits into
dmlc:masterfrom
chyunsu3:fix/remove-dead-compat-code

Conversation

@chyunsu3

Copy link
Copy Markdown
Collaborator

Closes #12086

PavelGuzenfeld and others added 8 commits March 15, 2026 20:46
- Remove `assert sys.version_info[0] == 3` — XGBoost requires
  Python >= 3.10 (pyproject.toml), making this check dead code.
  Using `assert` for version checks is also incorrect as assertions
  are stripped under `python -O`.

- Remove `sklearn.cross_validation` import fallback —
  `sklearn.cross_validation` was removed in scikit-learn 0.20 (2018).
  Any scikit-learn version supporting Python 3.10+ will have
  `sklearn.model_selection`.
@chyunsu3
chyunsu3 merged commit c21cf7f into dmlc:master Apr 14, 2026
46 of 47 checks passed
@chyunsu3
chyunsu3 deleted the fix/remove-dead-compat-code branch April 14, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants